in reply to PTKDB - exception catched Not a SCALAR reference
That's not how to dereference a hash ref. You're trying to deref it as a scalar, which it isn't, and that's why it's throwing the error.
I was wrong... $$href{try} does actually work. My bad :) I can't figure out why you're receiving that error with the code you've supplied though. Can you post more context?
Dereference individual items with the -> deref operator:
# hashref $h_ref->{try}; # arrayref $aref->[0]; # scalar $$scalar_ref;
...and to dereference entire structures:
# hash my %hash = %$hash_ref; # array my @array = @$aref;
If you need to dereference an entire list-type reference out of a nested structure, you need to use the circumfix operator:
# hash my %hash = %{ $hash_ref->{inner_href} }; # array my @array = @{ $aref->[0] };
A bit more complicated... extract one list-type variable out of a different list-type variable:
# array from href my @array = @{ $href->{inner_array} }; # hash from array ref my %hash = %{ $array->[0] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PTKDB - exception catched Not a SCALAR reference
by choroba (Cardinal) on Nov 24, 2015 at 17:28 UTC | |
by stevieb (Canon) on Nov 24, 2015 at 17:41 UTC | |
|
Re^2: PTKDB - exception catched Not a SCALAR reference
by pjkang7 (Novice) on Nov 24, 2015 at 17:47 UTC |