more useful options | |
PerlMonks |
Re: regexp bugby thelenm (Vicar) |
on Aug 27, 2002 at 17:10 UTC ( [id://193213]=note: print w/replies, xml ) | Need Help?? |
As hotshot said, giving examples of how it's failing will be very helpful. Please give some examples of input you're giving it and output you expect.
It's not clear what $count is supposed to be, but it will actually be either 0 or 1 depending on whether the pattern matches $_. If you want a true count of the number of matches, you should do something like this instead: I put the \Q and \E in there even though "foo" doesn't contain any special regex characters, because it guards against accidents if you search on something besides "foo" later. And you're correct to use /i to do a case-insensitive match. -- Mike --
In Section
Seekers of Perl Wisdom
|
|