Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Check/set hash of hashes value

by hdb (Parson)
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 drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-04-21 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (492 votes), past polls