in reply to Format file2
Your use strict; statement is embedded in a comment line, and is therefore not in effect. Put it on its own line, and you will get compile errors regarding OUT and $OUT.
Using the following:
I'd re-write the code as (UNTESTED):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;
|
|---|