Simple approach:
my $line_num = 1 + ( () = substr($text, 0, $-[0]) =~ /\n/g );
In reply to Re: Getting the line numbers of a multi-line match
by ikegami
in thread Getting the line numbers of a multi-line match
by Athanasius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |