open my $fp, \'<\', $file or die $!; while (<$fp>) { my $line = $_; if ($line =~ /$regex/) { # How do I find out which line number this mat
You can also do it through OO interface:
use IO::Handle; # later on ... my $n = $fp->input_line_number();
This is in perldoc perlvar, too.