Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: testing more than one item for equality

by Hofmator (Curate)
on Oct 18, 2006 at 11:40 UTC ( #579040=note: print w/replies, xml ) Need Help??


in reply to testing more than one item for equality

No, there is no more direct way to achieve that, afaik. You could get rid of the $result variable like this
if (grep { $_ eq $item3 } ($item1, $item2)) { #do something }
or of course write
if ($item1 eq $item3 or $item2 eq $item3) { ... }

-- Hofmator

Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://579040]
help
Chatterbox?
[Corion]: marto: A rough week comes to an end?
Corion has to finish off some test tickets and hopefully close them. Also I have to prepare some information for the tax people on the weekend :-/
[marto]: it feels like 2 weeks :)
[Discipulus]: sane dots for your weekend marto!
[choroba]: My week was hectic as well, and so will be the next several ones...
[Corion]: Sane Dots Supplies - your brand manufacturer for satisfying experiences!
[choroba]: preparing the trip to Vietnam + buying a new car = enough fun

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2017-01-20 10:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (174 votes). Check out past polls.