unimatrix 0 Report post Posted August 17, 2005 (edited) I am writing a script to add submit/add projects to a queue. I don't need a returned result other than it worked or failed. The script will execute a commandline like thisL'program -b $filename -s $start -e $end -a'all I need is for that command to be send and if it suceeds return a simple"This worked"or "This failed: here is why ___________". I am just trying to remember the difference between exec and system() for this task. I've read through the documentation and am still a little confused. It's the first time I've really used PERL in at least four years. Edited August 17, 2005 by microscopic^earthling (see edit history) Share this post Link to post Share on other sites
yordan 10 Report post Posted August 17, 2005 Read your doc carefully.On unix or Linux shell scripts, "exec" means "execute what I tell you and exit immediately after that".This means that, in Unix, all the lines after the exec instruction are ignored... Share this post Link to post Share on other sites
Digital Technic 0 Report post Posted November 3, 2005 Use backticks to capture output. $output = `program optional_arguments_jere`; Please note that those are backticks(on QWERTY it's right below the Escape key).Regards, Digital Technic. Share this post Link to post Share on other sites
crtburn 0 Report post Posted November 17, 2005 Use the system() function to execute a program without saving the program's output. The return value of the system() function is the program's exit status or you could check the special $? variable which will have it as well. The exit value 0 means the program exited successfully and anything else probably means there was a problem. If there was an error then it will be stored in $!. system("myprogram --foo $bar") == 0 or die "myprogram failed ($?): $!";print "myprogram ran successfully.\n"; Share this post Link to post Share on other sites