Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-07-22 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (453 votes). Check out past polls.

    Notices?