Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: string/array smart match regex failing meby JavaFan (Canon) |
on Jan 05, 2011 at 21:01 UTC ( [id://880677]=note: print w/replies, xml ) | Need Help?? |
Considering none of the strings in @pattern equals $string, I'm not surprised.
You cannot use ~~ to match a given string with an array of patterns. You can do the opposite: match a pattern against an array of strings. But you're matching a string against an array. And that is true iff there's an exact match of the string with at least one element of the array. See the perlsyn manual page.
In Section
Seekers of Perl Wisdom
|
|