Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Exact string match

by boo_radley (Parson)
on Jan 14, 2003 at 16:36 UTC ( #226881=note: print w/replies, xml ) Need Help??


in reply to Exact string match

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| {...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://226881]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2023-03-24 19:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (61 votes). Check out past polls.

    Notices?