Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Comparing against multiple values

by Anonymous Monk
on Feb 09, 2018 at 16:03 UTC ( #1208840=note: print w/replies, xml ) Need Help??


in reply to Re: Comparing against multiple values
in thread Comparing against multiple values

i don't know how to reply to the whole thread so i have used the last answer, sorry for that. if ($foo=~/$bar|$baz|$boo/){ is not strictly equivalent to if (($foo eq $bar) || ($foo eq $baz) || ($foo eq $boo)){ as =~ will be true for $foo=abc and $boo=ab but "abc" will not be eq to "ab" if you want them to be strictly equivalent then it will be something like : if ($foo=~/^$bar$|^$baz$|^$boo$/){ i have tested with string values but not with $var so maybe there is some \ to use at the good places for this to work regards.
  • Comment on Re^2: Comparing against multiple values

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2018-08-19 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (186 votes). Check out past polls.

    Notices?