in reply to Re^4: Running a C program from Perl
in thread Running a C program from Perl
Personally, I would expect the one-liner to print bash: egrepa: command not found - as it does if entered from command line - but doesn't.
The shell was never invoked, so how can it display an error message? It's up to you to do your own error checking.
$ perl -e'$res = `egrepa 2>&1`; print "$?:$!\n"; print $res' -1:No such file or directory (( Perl tried to execute egrepa, couldn't, and returned an error. Perl doesn't output error messages for you. )) $ perl -e'$res = `egrepa "" 2>&1`; print "$?:$!\n"; print $res' 32512: sh: egrepa: command not found (( Perl sees a shell command, and successfully executed the shell. The shell couldn't execute egrapa "", so it displayed and returned an error. ))
|
|---|