P is for Practical | |
PerlMonks |
Re^3: Effect of redirecting output to /dev/null on $? valueby ikegami (Patriarch) |
on Aug 03, 2020 at 17:01 UTC ( [id://11120261]=note: print w/replies, xml ) | Need Help?? |
By asking to system execute the specified program instead of asking the system to execute /bin/sh.
There's no point in including an entire shell in Perl. I don't know exactly what part of shell command parsing is implemented in Perl.
system($cmd), exec($cmd), open(my $pipe, '-|', $cmd) (and its 2-arg form) and open(my $pipe, '|-', $cmd) (and its 2-arg form) work the same way as `$cmd` (aka qx`$cmd` aka readpipe($cmd)). system($prog, LIST) where LIST returns at least one scalar won't invoke the shell.[1] system({ $prog } $prog, LIST) won't invoke the shell.
In Section
Seekers of Perl Wisdom
|
|