if (ref($hash{$_}) eq 'ARRAY')
I dont understand this.. Does the word 'ARRAY' have a special meaning in this context? What more such special words are there, and where is it possible to read about this? Appearently it does not work to write 'array' in lc.
| [reply] [d/l] |
| [reply] |
ref returns the following values:
- SCALAR
- ARRAY
- HASH
- CODE
- REF
- GLOB
- LVALUE
And it those that you must test for - depending on what you are looking for.
| [reply] |
Just to disambiguate a little: ref returns SCALAR for a reference to a scalar. For a simple scalar it returns undef.
Note too that ref returns the object type for an object so the range of strings that can be returned is essentially unlimited.
DWIM is Perl's answer to Gödel
| [reply] [d/l] [select] |