in reply to Check/set hash of hashes value

It's not if( undef $subnets{$ip}{$comment} ), it's if( ! defined $subnets{$ip....

Right now you're setting $subnets{$ip}{$comment} to undef.


Dave

Replies are listed 'Best First'.
Re^2: Check/set hash of hashes value
by stroke (Acolyte) on Jun 24, 2013 at 17:30 UTC

    Thanks Dave, so let me get this right - here, the value I was attempting to check if it was undef, I was effectively setting the value to undef !

      Just as you wouldn't use "=" to test equality (you would use "=="), you wouldn't use "undef" to test definedness, you would use "defined".

      undef will undefine its operand. defined will test its operand.


      Dave

      Exactly. See undef, which is a wildly different function than defined.

      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.