in reply to Running blocks of shell script from within perl script
Of course, the example above is a bit ridiculous, I would not call the shell from Perl to do this, but I was just trying to give an example of some possibility of multi-line shell command run from Perl. You can even run the command directly from Perl without having to use a variable:$ perl -e ' > my $sh_command = "( > echo foo > echo bar > echo baz > )"; > exec $sh_command; > ' foo bar baz
Or even:$ perl -e ' > exec "( > echo foo > echo bar > echo baz > )"; > ' foo bar baz
$ perl -e ' > exec "( > echo bar > echo bar > echo baz > ) | wc > "; > ' 3 3 12
|
|---|