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:
What am I doing wrong!?!$linenumber=1; foreach $line(@fileData) { $linenumber=$linenumber+1; if ($line =~ m/^1$/) { print "$linenumber\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Help with regex
by FunkyMonk (Chancellor) on Sep 28, 2007 at 16:33 UTC | |
by ChuckularOne (Prior) on Sep 28, 2007 at 16:40 UTC | |
by gam3 (Curate) on Sep 28, 2007 at 17:28 UTC | |
by Not_a_Number (Prior) on Sep 28, 2007 at 16:52 UTC | |
Re: Help with regex
by toolic (Bishop) on Sep 28, 2007 at 16:32 UTC | |
by tinita (Parson) on Sep 28, 2007 at 16:48 UTC | |
by mr_mischief (Monsignor) on Sep 28, 2007 at 17:45 UTC | |
Re: Help with regex
by throop (Chaplain) on Sep 28, 2007 at 19:50 UTC | |
by FunkyMonk (Chancellor) on Sep 28, 2007 at 20:16 UTC |
Back to
Seekers of Perl Wisdom