#!/usr/bin/perl #Do you want to use a perl variable as if it were a file? #Previous versions of perl had IO::Stringy and IO::Scalar for that. #Perl 5.8 with PerlIO has it natively. Just use a reference to #the scalar in the filename slot of open. my $foo = ''; open FILEHANDLE, '+>', \$foo or die $!; print FILEHANDLE "Contents of File"; seek(FILEHANDLE,0,0); my @contents = ; close FILEHANDLE or die $!; print 'From $foo: ', $foo, $/; print 'From file read: ', @contents, $/;