#!/usr/bin/perl use Modern::Perl; # 937262 my @chars = qw( a b c ? : ! f g ); my @newchars = (); for my $char(@chars) { if ($char =~ /[[:alpha:]]/ ) { # posix: letters. cf alts for + unicode "Properties" usage push @newchars, uc($char); }else{ push @newchars, $char; } } for my $newchar(@newchars) { print $newchar . " "; # A B C ? : ! F G }
In reply to Re: Array slice vs foreach and push
by ww
in thread Array slice vs foreach and push
by chrisburel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |