grep { print } @array;
Or even...
use List::MoreUtils qw<first>;
first { not print } @array;
I can imagine many newbies scratching their heads if they saw that one! But I told it to "not print" the array! ;-)
Update: of course, there's the venerable...
print shift @array while @array;
... which prints, but also dismantles an array.
my @r;@r = reverse @array and do { print pop @r while @r };
# Now I'm just being silly!
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
|