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

Re: variable number of hash of hashes

by i5513 (Monk)
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,


Comment on Re: variable number of hash of hashes
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2014-07-26 01:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls