use IO::Scalar; tie *STDOUT, 'IO::Scalar', \$a; @args = ("/bin/ls", "-al"); print system(@args); untie *STDOUT;