MiamiGenome has asked for the wisdom of the Perl Monks concerning the following question:
Greetings PMs,
I am searching for a simple method to fill an array as follows :
$array[0]= "A01"; $array[1]="A02";
..... and so on until
$array[95]="H12";
In this array, letters range from A thru H, and numbers range from 01 thru 12.
Is this the 'best' way:
@arrayletterlist = qw(A B C D E F G H); @arraynumberlist = qw(01 02 03 04 05 06 07 08 09 10 11 12); $count = 0; foreach $arrayletter (@arrayletterlist) { foreach $arraynumber (@arraynumberlist) { $masterarray[$count] = $arrayletter . $arraynumber; $count++; } }
Back to
Seekers of Perl Wisdom