in reply to "Casting Question"

Your ideas are correct, your terminology is just off. If the documentation of Some_Method tells you to stuff the result into a scalar, it isn't returning a hash, it's returning a reference to a hash. You need to dereference (not cast) the hash reference into a hash, and then look up the key in a hash.

%hash = %{$hashref} takes the hashref and dereferences it into a hash, then $hash{key} will look up in that hash. You can also write $hashref->{key}, which dereferences and looks-up in one operation (and is thus much more memory-efficent for large hashes).


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).