http://www.perlmonks.org?node_id=641566

ChuckularOne has asked for the wisdom of the Perl Monks concerning the following question:

I have been digging and digging in the archives here and in Programming Perl and in Mastering Regular Expressions to no avail. I am parsing a file into a list and the foreach-ing through that list. I'm trying to find out if any lines contains only "1\n" (Which is what several hundred lines contain.) I am using the following code:
$linenumber=1; foreach $line(@fileData) { $linenumber=$linenumber+1; if ($line =~ m/^1$/) { print "$linenumber\n"; } }
What am I doing wrong!?!