wrote:
> Can anyone tell me or point to a reference to know more about using
> non-numeric indices for arrays?
Perl's arrays require numeric indices, so, it seems like you are out of
luck.
> If so, how can I use it for my applications?
Depends on your application.
> Typical scenario would be database records, where I want my index to be
> based off Last name . and would like to access the array as
>
> $Record[$LastName][$Salary] = $1000;
Well, that is not going to work. First, $1000 is likely to contain a
meaningless value as you probably did not have a regex match with at
least 1000 captures prior to this line. Second, $LastName and $Salary
are likely not integers.
On the other hand, in Perl, you could use a hash:
my %records;
$records{$last_name}{$salary} = '$10000';
But that's silly as well: I mean, what would $salary contain? Hmmm ...
How about
:
$records{$last_name}{salary} = '$10000';
Please do visit
<URL:http://learn.perl.org/>
and read the posting guidelines for this group.
> This way I dont need to parse the entire list (myself) to find the
> matching last name and then assign that record the salary value.
This makes absolutely zero sense. What does any of this have to do with
parsing?
Sinan