open my $fh, ">", "./foo.txt" or die( "Couldn't etc." ); print $fh "$_\n" for 1..100; truncate $fh, 0; print $fh "$_\n" for 1..10; close $fh;