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 | |
by AnomalousMonk (Archbishop) on Jun 05, 2015 at 18:04 UTC |