Help for this page
flush STDOUT;
my $fh; my $out; ... select $old_stdout; close $fh; print $out; # This has the output you want