Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Check/set hash of hashes value

by hdb (Monsignor)
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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040451]
help
Chatterbox?
[Discipulus]: ah! how do you say in english? .. i was sure..
[Discipulus]: ah turned
[pryrt]: I think I actually like "finished 18", because really, it's been 18years since his birth, so he's finished 18 years. :-)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2018-01-18 20:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (214 votes). Check out past polls.

    Notices?