$ cat foo #!/usr/bin/perl print STDOUT "hello\n"; print STDERR "world\n"; $ cat bar #!/usr/bin/perl use 5.010; my $output = `./foo 2>&1`; say "[[$output]]"; $ chmod +x foo $ chmod +x bar $ ./bar [[world hello ]] $