http://www.perlmonks.org?node_id=1040452


in reply to Check/set hash of hashes value

++davido and ++hdb. If you'd like to save yourself a little typing and are using 5.10 or better (probably), you could use Logical Defined Or Assignment Operators to produce what is cleaner and more obvious to me (YMMV):
foreach my $ip ( keys %subnets ) { $subnets{$ip}{comment} //= 'ALLOCATED'; }

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