in reply to Testing for hash key value
What you need is ref. For example:
foreach my $val (values %hash) { if (ref $val eq 'HASH') { # Update: oops, was numeric equality; th +anks chromatic print "Hash\n"; } else { print "Not Hash\n"; } }
That said, using ref for this sort of thing often means you need to do some refactoring. For further discussion, see Testing for existence of subroutine ref?.
|
|---|