in reply to Re: Array Reference (Again)
in thread Array Reference (Again)
if ( ref($ref) eq 'HASH') { # return the elements as list. No real practical value other # than as an exercise.. at least as much as I can see return 'ref to HASH', values %$ref; } elsif (ref($ref) eq 'ARRAY') { # return the elements as a list return 'ref to ARRAY', @$ref; } elsif (ref($ref) eq 'SCALAR') { return 'ref to SCALAR', $$ref; } elsif ( not ref($ref)) { return 'not a ref'; } # and so on.. }
You don't list all reference types; missing are: REF, CODE, and GLOB.
Maybe I'm just picking nits :)
Jon
|
|---|