use strict; use warnings; $a = "test", $b = "myfile"; open(IN, $a) || die "cannot open for reading, $! "; open(OUT,">$b") || die "cannot open for writing, $! "; while () { print OUT "NO", "\n", " 'SOURCE' ", "SEC", "Q", "SEC ", "\n", "LONG", "LAT", "DEPTH", "GAP" } close (IN); close (OUT);