Perl, system, .
LIST LIST , , , , . , , , ...
:
system("perl", "-le", "print qq(Hello)") == 0
or warn "$0: perl exited " . ($? >> 8);
Remember that systemruns a command with output to standard output. If you want to capture the output, do as in
open my $fh, "-|", "perl", "-le", "print qq(Hello)"
or die "$0: could not start perl: $!";
while (<$fh>) {
print "got: $_";
}
close $fh or warn "$0: close: $!";
As with c system, opening a command specified as a list of several items bypasses the shell.
source
share