my $old_STDOUT = \*STDOUT; my $capture; open STDOUT, '>', \$capture or die "Couldn't do in-memory capture of program output: $!";