When I run your code with my own input, the output I get is the line number plus 1 of the lines which just contain 1\n. To get the actual line number:
$linenumber=1; foreach $line(@fileData) { if ($line =~ m/^1$/) { print "$linenumber\n"; } $linenumber++; }
tinita is more precise. $. is used with filehandles.
In reply to Re: Help with regex
by toolic
in thread Help with regex
by ChuckularOne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |