#!usr/bin/perl use strict; use warnings; use Capture::Tiny qw(capture); my ($stdout, $stderr, $exit) = capture { system('ls', '-l'); }; print "After the system call:\n"; print "\$stdout = $stdout\n"; print "\$stderr = $stderr\n"; print "\$exit = $exit\n";