my $line="Whatever line you want to insert"; open FH, '>mytextfile.txt' or die $!; print FH $line; close FH;