Chris Wagner wrote:

> What do u mean by an array of the alphabet?  Arrays in perl can have numeric
> indexes only.  So something like @array[a] is invalid.  U can specify two
> dimensional values like $array[1][1] = "a";  that's offset column 1 row 1.
> There are various methods to automatically generate a 2D array with loops
> and maps.
> 
> 3x3 2D array:
> @array = (["a", "b", "c"], ["e", "f", "g"], ["h", "i", "j"]);
> 
> print $array[2][3];

You can always subtract/add 'A' (or 'a') from/to the row/col and get a 0..25 
number.

my @entry;
foreach my $row (0..25) {
        foreach my $col (0..25) {
                $entry[$row][$col] = $row * 100 + $col;
        }
}

my $bias = ord 'A';
my $letter_row = ord 'Q';       # where Q is the row you want
my $letter_col = ord 'S';       # where S is the col you want

# get value for [Q][S]:

my $val = $entry[$letter_row - $bias][$letter_col - $bias];
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to