Another example using grep. This one isn't much shorter, but where it'll help is if you have to check more elements; simply add the element number to the array slice, and update the equal-to count number.
if ((grep /^0$/, @array[0,1]) == 2){ say "both are zero"; }
In reply to Re: Check multiple array elements for a single condition
by stevieb
in thread Check multiple array elements for a single condition
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |