Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^3: Hashes as return valuesby g0n (Priest) |
on Jan 17, 2006 at 16:09 UTC ( [id://523764]=note: print w/replies, xml ) | Need Help?? |
The error means exactly what it says, 'keys' needs a hash, not a hashref, or anything else. This works:
Note the %{} round $obj->{acls} dereferencing the hashref into a hash. Update: Just as added clarification, since you were talking about return values from functions:
The second for loop calls acls() to get at the content of the attribute {acls}, dereferences it, and iterates through printing the keys. The first loop is accessing the hashref directly, rather than through a function call.
-------------------------------------------------------------- "If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing." John Brunner, "The Shockwave Rider".
In Section
Seekers of Perl Wisdom
|
|