in reply to Writing to a file handle not attached to a file?
With a recent (i.e. 5.8.0 onward) perl you can simply open a filehandle to a reference to a scalar rather than a filename. E.g. :
In older perls you might want to see IO::Scalar for instance.my $foo = ""; + open BAR, '>', \$foo; + print BAR "Test test"; close BAR; + print $foo;
In Section Seekers of Perl Wisdom