in reply to using shift and $_ in loop

No need to test the shift in a loop.

$ perl -le ' > sub isname { return 1 if $_[ 0 ] =~ m{(?i)^(?:bill|fred)$} } > @a = qw{ apple peach fred }; > sub alter > { > my @new = > map { uc } > grep { isname( $_ ) } > map { my $w = shift } > 0 .. $#_; > } > @A = alter( @a ); > print for @A;' FRED $

I hope this is of interest.

Cheers,

JohnGG