Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: How to check whether my array contains element x

by MidLifeXis (Monsignor)
on Jan 17, 2013 at 13:33 UTC ( [id://1013781]=note: print w/replies, xml ) Need Help??


in reply to Re: How to check whether my array contains element x
in thread How to check whether my array contains element x

You might want to change /^$value$/ to /^\Q$value\E$/, especially if $value may contain re metacharacters, but it depends on the application.

while (<>) { chomp; print qr(^$_$), "\t", qr(^\Q$_\E$), "\n"; } __END__ foo (?-xism:^foo$) (?-xism:^foo$) foo[bar] (?-xism:^foo[bar]$) (?-xism:^foo\[bar\]$)

--MidLifeXis

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-19 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found