P is for Practical | |
PerlMonks |
RE: pattern matching: why does the following code evaluate true? (and how do i fix it?)by Adam (Vicar) |
on May 31, 2000 at 02:42 UTC ( [id://15536]=note: print w/replies, xml ) | Need Help?? |
Greedy Pattern Matching. The . matches anything (and more importantly - everything.) {Except \n} UPDATE: It has been pointed out to me that I am only partly correct. The dot does in fact match anything {Except \n} but it does not behave in a greedy manner. Rather, Perl is saying that the substring ($key2) is found in the other string ($key)... which is ok. I apologize if I confused anyone.
In Section
Seekers of Perl Wisdom
|
|