in reply to Help with regex
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with regex
by tinita (Parson) on Sep 28, 2007 at 16:48 UTC | |
|
Re^2: Help with regex
by mr_mischief (Monsignor) on Sep 28, 2007 at 17:45 UTC |