in reply to Array slice vs foreach and push

perl -w -le 'my @chars = qw( a b c ? : ! f g ); my @up_chars = map { tr/a-z/A-Z/; $_ } @chars; print "@up_chars"'

hope this would help.

Replies are listed 'Best First'.
Re^2: Array slice vs foreach and push
by jwkrahn (Abbot) on Nov 10, 2011 at 11:46 UTC

    my @up_chars = map { tr/a-z/A-Z/; $_ } @chars; can be reduced to: my @up_chars = map uc, @chars;

      nice