in reply to How to continue numbering after a regular expression has been found

while ( <DNAFILE> ) { next if (/fixedStep chrom=chrX start=(.+) step=1/); $counter = $1; } print "$counter\t$_\n";

There are some issues with your code:

The following code might help you (untested!!)
while ( <DNAFILE> ) { if (/fixedStep chrom=chrX start=(.+) step=1/) { $counter = $1; } else { print "$counter\t$_\n"; $counter++; } }
as you see, it is quite similar to your awk-code.

HTH, Rata