use IO::File; my $fh = IO::File->new_tmpfile; . . . $fh->seek(0, 0); print STDOUT $_ foreach <$fh>; $fh->close;