The problem with that is that exec() doesn't return the return value of the command, which I needed for this particular thing. What I wanted was 'system(string command)' and I can get everything else I need out of $?.
The return value is the exit status of the program as returned by the "wait" call. To get the actual exit value, shift right by eight (see below). See also "exec". This is not what you want to use to capture the output from a command, for that you should use merely backticks or "qx//", as described in "`STRING`" in perlop. Return value of -1 indicates a failure to start the program or an error of the wait(2) system call (inspect $! for the reason).
Comments 6
Isn't string exec (string command [, string array [, int return_var]]) the function for executing a command?
Reply
Reply
by the "wait" call. To get the actual exit value, shift right
by eight (see below). See also "exec". This is not what you
want to use to capture the output from a command, for that you
should use merely backticks or "qx//", as described in
"`STRING`" in perlop. Return value of -1 indicates a failure
to start the program or an error of the wait(2) system call
(inspect $! for the reason).
Reply
But I'm not a programmer (I just want to get the job done, not make it elegant) :p
Reply
Leave a comment