my $filecontents = $t->get("1.0", "end"); chomp($filecontents); print TEMP $filecontents; #### my $filecontents = $t->get("1.0", "end"); $filecontents =~ s/\n+\z/\n/; print TEMP $filecontents;