[ABE.pm] Accessing data in an array?
Faber Fedor
faber at linuxnj.com
Mon Nov 29 17:17:14 CST 2004
Hi guys,
I've got an array of...references? that looks like this:
my @indices = ( { index=>"r1", weight=>"r1weight", cap=>"r1_mkt"}
{ index=>"r2", weight=>"r2weight", cap=>"r2_mkt"}
{ index=>"r3", weight=>"r3weight", cap=>"r3_mkt"}
{ index=>"rm", weight=>"rmweight", cap=>"rm_mkt" }
);
What I've been doing is looping through them so I could get at the data
like this:
for(@indices) {
print $_->{index} . "\t" . $_->{weight} . "\n";
}
but now I need to access each internal reference(?) without looping.
IOW, if I have $var = "r3", how do I access the array such that
$indices->{weight}="r3weight"?
--
Regards,
Faber
Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com
More information about the ABE-pm
mailing list