Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-09-2009
Member
 
Join Date: Feb 2009
Posts: 50
How to use exceute Perl Command

Hi,
I am a newbie in Perl. I ha just finished up a couple of days learning the programming language. I am working on assignment to create a simple program in Perl. I am now stuck in exec part of Perl. I am not getting a proper result when I implement this syntax. I had tried the same many time from start. But no progress yet. Can anyone post some solution that can help me to figure out how to execute a Perl command. That means how can I use exec and system in the same. Thanks in advance.
Reply With Quote
  #2  
Old 12-09-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: How to use exceute Perl Command

The format of exec is as listed below. You can match your work with it which can help you to figure out the difference in your work. In Perl both exec() and system() are able to execute a system shell command. The only main difference between both the function is that if you use exec() function then it will just simply execute the command and while system() executes the command and wait that the command is executed successfully and denotes that by returning a value.
exec(PROGRAM);
$result = system(PROGRAM);
Reply With Quote
  #3  
Old 12-09-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: How to use exceute Perl Command

The function of exec is used to execute a command in Perl directly that does not return back any calling script. The operation works when there is a single scalar argument which does not has any shell metacharacters. After that the argument is converted to list and the command is executed with no shell. Here a list consist of more than single argument or a array that contains more than one value. See the sample below.
exec {'/bin/csh'} '-sh'; # pretend it's a login shell
Reply With Quote
  #4  
Old 12-09-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: How to use exceute Perl Command

I am listing some samples that can help you to execute a program either by using exec() function or system() function. First in exec() it just simply runs a commands without any feedback. So you does not get aware that does the command is successful or not. But the same in system() case is more reliable. If you execute a command by this function then it gives you feedback in value up on the success of command in the shell.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use exceute Perl Command"
Thread Thread Starter Forum Replies Last Post
How to boost command points in Command & Conquer Tiberium Alliances? Charu Sharma Video Games 2 21-03-2012 03:23 AM
What is PERL and what are its uses? Gadin Software Development 10 08-01-2011 07:33 PM
What are the best Perl forums? Megatruck Software Development 5 26-12-2010 01:37 AM
Problem: Command Line Option Syntax Error. Type Command /? For Help Nadeem MediaCenter 3 03-09-2009 05:41 PM
autorun.inf - shell\..\command with command line parameter doesn'twork kakii Windows XP Support 1 18-05-2007 01:24 AM


All times are GMT +5.5. The time now is 02:31 PM.