Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: variable number of hash of hashes

by i5513 (Pilgrim)
on Jul 24, 2012 at 08:21 UTC ( #983327=note: print w/replies, xml ) Need Help??


in reply to variable number of hash of hashes

Hello,

Be careful with your code:

1. %hash{'string1'}{'string2'}{'string3'}{'string4'}++; 2. %hash{'string3'}{'string4'}++; 3. %hash{'string1'}{'string2'}{'string3'}++;

In 1 you are defining {'string1'}{'string2'}{'string3'} with a hash, and in 3 you want to add 1 to that hash ... which is not that you want

Use a final string like "n" or "count", like GrandFather propose:

1. $hash{'string1'}{'string2'}{'string3'}{'string4'}{n}++; 2. $hash{'string3'}{'string4'}{n}++; 3. $hash{'string1'}{'string2'}{'string3'}{n}++;
Regards,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983327]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2016-12-04 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (69 votes). Check out past polls.