use strict; use warnings; my $fin = "SELECTDAT2"; my $fout = "myfile"; open my $ih, '<', $fin or die "cannot open $fin for reading, $! "; open my $oh, '>', $fout or die "cannot open $fout for writing, $! "; while (<$ih>) { print $oh "NO", "\n", " 'SOURCE' ", "SEC", "Q", "SEC", "\n", "LONG", "LAT", "DEPTH", "GAP"; } close $oh; close $ih;