in reply to Re: Regex variable capturing gotcha
in thread Regex variable capturing gotcha

As a sidenote, instead of keeping a line counter yourself, you can use Perl's $. variable,
Good advice, but it looks like it's a match count, not a line count.