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:
Regards,1. $hash{'string1'}{'string2'}{'string3'}{'string4'}{n}++; 2. $hash{'string3'}{'string4'}{n}++; 3. $hash{'string1'}{'string2'}{'string3'}{n}++;
|
---|
In Section
Seekers of Perl Wisdom