Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-21 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (101 votes), past polls