in reply to Re: dereferencing hash within a hash within an array
in thread dereferencing hash within a hash within an array
To clarify: If the array element $data[$x] contains a valid reference to a hash, then you need dereference that using -> to indicate that this is the case.
No, you don't need to do so.
my %h = ( foo => 'bar' ); my @a = ( \%h ); print "worked fine\n" if $a[0]{foo} eq 'bar';
You need to use the arrow when you are dealing directly with a scalar containing a reference rather than a nested one.
my %h = ( foo => 'bar' ); my @a = ( \%h ); my $r = \@a; print $r->[0]{foo}, "\n"; # $r[0] won't work since @r doesn't exist.
-sauoq "My two cents aren't worth a dime.";
|
|---|