in reply to how to identify a null hash value

So it looks like the hash %hh has a key of 'QUESTION_TEST', who's value is itself another hash, so $value will always be a reference to that hash.

I think you need to post more code above this section, particularly where %hh hash is being defined and set up. You also need to explain what CHECKSOMETHING actually is.

-stevieb

Replies are listed 'Best First'.
Re^2: how to identify a null hash value
by smartyollie (Novice) on Jun 04, 2015 at 20:40 UTC
    I've tried various things for CHECKSOMETHING, see the four IF statements I listed at the end of my post.

      ahhh, I see. Again though, it does appear from what you've posted that $value DOES contain data, and if that's the case, all of your tests will be true.

      One way to see if I'm correct in thinking you've got a defined value (hashref) is this:

      print "it's a hashref\n" if ref($hh{'QUESTION_TEXT'}) eq 'HASH';

      -stevieb

        I see you are saying it's defined, but I want to check if it contains any data - has a non null value. The dumper output shows an empty hash as its value, but I want to print something different if it has an empty hash, vs a non empty hash. That's my else clause - but I can't get that else clause to execute. And note that it is an empty hash, but it doesn't print a null string when I print it - instead, it prints "HASH(xxxx)" string, which I don't want