Dynamically creating a hash for keys()
[email protected] (Jason Foster)
| Newsgroups | perl.fwp |
|---|---|
| Message-ID | <[email protected]> |
Can anyone help me to understand why this code refuses to compile?
Even better, can anyone help fix it :)
%hash = qw( fred filntstone barney rubble tom delong );
print( keys( reverse( %hash ) ) );
The error message...
Type of arg 1 to keys must be hash (not reverse) at ./killme.pl
line 4, near ") ) "
... was pretty confusing since it implies that "reverse" is a type?!
I tried making an anonymous hash as follows...
print( keys( %{ reverse( %hash ) } ) );
... but got no results at all.
Help!