Hi Ben - I have three general suggestions:
use strict; use strict; use strict; 'strict' forces you to pre-define your variables; it makes the code more readable, AND will save you many times over from misspelling errors (when this happens, perl merrily creates a new variable with the misspelled name and continues on its way - your intended variable is not used - hard to find this type of problem). Your code would look like this with strict: use strict; use warnings; # put this guy in too - he will alert you to possible problems sub HoA { my @temparray; foreach my $arb (@uniqueroadname) { foreach my $doublearb (@contents) { if ($doublearb =~ m|$arb|) { print "$arb ==== $doublearb\n"; push @temparray, $doublearb; } } } my %arrayref; # this is actually a hash from the syntax you use below # oops! $arb is out of context! it was defined within # the first foreach loop above!!?? - and has no meaning here,,, $arrayref{$arb} = [@temparray]; } Now, where do @uniqueroadmap and @contents come from? To answer you arrayref access question, get the elements with this syntax: my $ele0 = $arrayref{$arb}->[0]; my $ele1 = $arrayref{$arb}->[1]; You seem to be making all of this too hard. Maybe you should start at the beginning again, an I will help you simplify the solution. Aloha => Beau. -----Original Message----- From: Ben Crane [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 12:05 AM To: [EMAIL PROTECTED] Subject: Hash Access Query 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 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]