in reply to Check multiple array elements for a single condition

you can use the smartmatch operator but is not a big improvement:
perl -mstrict -we "my @arr=(1,2,2);print 'both' if [2,2] ~~ @arr[1,2]" both
or if you just want 2 casual elements to be equal to 2 you can chek the lenght of the list returned by grep
perl -mstrict -we "my @arr=(1,2,2);print 'exactly two' if (grep{$_==2} +@arr) == 2" exactly two

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.