in reply to Filling An Array
If you wanted to use some magic, you could do this instead:for my $letter ('A'..'H') { for my $num (1..12) { push(@masterarray, sprintf("$letter%02d", $num)); } } print scalar(@masterarray)," elements\n";
or evenfor my $letter ('A'..'H') { push(@masterarray, $letter.'01'..$letter.'12'); }
# The golfiest my @masterarray = map { $_.'01'..$_.'12' } 'A'..'H';
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Filling An Array
by Qiang (Friar) on Apr 23, 2004 at 03:39 UTC |