#!/usr/bin/perl -w use FileHandle; my $fh = FileHandle->new('test','+>'); print $fh $_ while (); $fh->close; __DATA__ Test this