Perl tricks

Put the STDOUT to a variable

open($fh, ‘>-‘);
print $fh, “hello world\n”;

Link a file handle to a string (since Perl 5.8)

open($fh, ‘<‘, \$string);

Leave a Reply