develooper Front page | perl.beginners | Postings from December 2002

Hash Access Query

Thread Next
From:
Ben Crane
Date:
December 3, 2002 02:05
Subject:
Hash Access Query
Message ID:
20021203100439.23457.qmail@web41110.mail.yahoo.com
Hi,

right, my first attempt at a hash of arrays appears to
have some success...but I have a query:

sub HoA
{
foreach $arb (@uniqueroadname)
{
foreach $doublearb (@contents)
{
if ($doublearb =~ m|$arb|)
{
print "$arb ====  $doublearb\n";
push @temparray, $doublearb;
}
}
}
 $arrayref{$arb} = [@temparray];
}

as far as I've tested, %arrayref contains ARRAY0x23233
-> etc...but I'm trying access that array:

$arrayref{$arb}[0] = will access the first array after
"following" a specific reference? Therefore, do I
access individual elements of that array through
$arrayref{$arb}[0][1]??

at the moment, the structure looks (i hope :) like
this:

%HASH - > Reference (roadname) -> Array 1
                               -> Array 2
                               -> Array 3

i reference the roadname which takes me to the next
tier, and then I can access all the arrays containing
info about that particular roadname (reference)...I
guess it's a one-many relationship...

Ben

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About