in reply to how to identify a null hash value

you can try the next code as its worked for me:

my %hh = ('QUESTION_TEXT' => 0); # my %hh = ('QUESTION_TEXT' => {}); # my %hh = ('QUESTION_TEXT' => {'F'=> 3}); my $value = $hh{'QUESTION_TEXT'}; if(ref($value) eq 'HASH'){ $HashSize = @TemArr = keys $hh{'QUESTION_TEXT'}; # to get hash +size to tesitng }else{ $HashSize = 1; # not hash (may be ARRAY or SCALAR or ... etc) } # print "--[$HashSize]\n"; if($HashSize){ print "[$value]\n"; }else{ print "[NULL]\n"; }

Replies are listed 'Best First'.
Re^2: how to identify a null hash value
by smartyollie (Novice) on Jun 05, 2015 at 17:16 UTC
    Thank you, this works although it gives me a perl warning
    keys on reference is experimental at <program>.pl line NNN.
    How to suppress?

      keys %{ $hh{'QUESTION_TEXT'} } or better yet, IMHO,  keys %$value (untested).


      Give a man a fish:  <%-(-(-(-<