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.
In reply to Re: Compare all array values without a loop
by Random_Walk
in thread Compare all array values without a loop
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |