http://www.perlmonks.org?node_id=400568


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.