open my $fh, ">:scalar:raw", \ my $stored_output or die "Couldn't open memory handle: $!"; print $fh "Hello world!"; print $stored_output;