my $file1_temp = "output.txt"; open (FILE1_TEMP, "+>$file1_temp") or die "Could not open $file1_temp: $!"; print FILE1_TEMP "hello, world!"; while () { print $_; } close FILE1_TEMP;