Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Compare all array values without a loop

by Random_Walk (Prior)
on Oct 19, 2004 at 15:54 UTC ( #400568=note: print w/replies, xml ) Need Help??


in reply to Compare all array values without a loop

Just for fun here is an evil eval way to do it without a loop.

@a=('A', 'B', 'C', 'D'); $b='D'; if (eval "if(\$b eq \"".(join"\"){return 1}if(\$b eq \"",@a)."\"){retu +rn 1}") { Print "It was there\n" }

Cheers,
R.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2018-09-22 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (190 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!