RosettaCodeData/Task/Execute-a-system-command/Perl/execute-a-system-command.pl

10 lines
334 B
Perl

my @results = qx(ls); # run command and return STDOUT as a string
my @results = `ls`; # same, alternative syntax
system "ls"; # run command and return exit status; STDOUT of command goes program STDOUT
print `ls`; # same, but with back quotes
exec "ls"; # replace current process with another