Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Check/set hash of hashes value

by hdb (Prior)
on Jun 24, 2013 at 16:18 UTC ( #1040451=note: print w/ replies, xml ) Need Help??

in reply to Check/set hash of hashes value

I think you should be using $subnets{$ip}{'comment'} instead of $subnets{$ip}{$comment} unless the variable $comment contains the string 'comment'.

UPDATE: (before I had seen kennethk's post or he this update:) The whole thing can be expressed as (in newer versions of Perl):

$subnets{$_}{'comment'} //= 'ALLOCATED' for keys %subnets;

UPDATE 2: Comment from kennethk: code can also be written as

$_->{comment} //= 'ALLOCATED' for values %subnets;

Comment on Re: Check/set hash of hashes value
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040451]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (19)
As of 2015-11-30 17:28 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (777 votes), past polls