http://qs1969.pair.com?node_id=580706


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. :

my $foo = ""; + open BAR, '>', \$foo; + print BAR "Test test"; close BAR; + print $foo;
In older perls you might want to see IO::Scalar for instance.

/J\