![]() |
|
There's more than one way to do things | |
PerlMonks |
Re: Exact string matchby boo_radley (Parson) |
on Jan 14, 2003 at 16:36 UTC ( #226881=note: print w/replies, xml ) | Need Help?? |
well, if you're looking for an exact match, use eq if ($row eq "$m$names[$k]$m") {... If you're compelled to use a regex, use anchors to either determine if there's a word in the string that matches your criteria (using the \b anchor) if ($row =~ m|\b$m$names[$k]$m\b| {... or the entire string using \A and \z : if ($row =~ m|\A$m$names[$k]$m\z| {...
In Section
Seekers of Perl Wisdom
|
|