http://www.perlmonks.org?node_id=997692


in reply to Re^2: How do you find keys of a Blessed Hash?
in thread How do you find keys of a Blessed Hash?

perl-diddler:

Assuming Corion located the problem for you, then you need only dereference the hash yourself, rather than relying on keys to do it for you:

$ cat test.pl #!/usr/bin/perl *STDERR = *STDOUT; $|=1; my $hr = bless {a=>1, b=>2}, "food"; print "Manual deref: ", join(", ", keys %$hr), "\n"; print "Auto deref: ", join(", ", keys $hr), "\n"; $ perl test.pl Manual deref: a, b Type of argument to keys on reference must be unblessed hashref or arr +ayref at test.pl line 8.

Update: Fixed formatting.

...roboticus

When your only tool is a hammer, all problems look like your thumb.