Backticks capture output, but system doesn't. Using exec directly is too much work. open '|-' would be the appropriate choice here.
$ perl -e' > my @cmd = ( echo => "foo\nbar" ); > open(my $fh, "|-", @cmd); > print <$fh>; > ' foo bar
Bonus: The shell isn't involved if the command has an argument.
In reply to Re^2: Backtics execution with multiple lines
by ikegami
in thread Backtics execution with multiple lines
by ivanatora
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |