Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 perusing the Monastery: (10)
As of 2015-07-03 18:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (55 votes), past polls