in reply to Re^2: Determine largest key in hash
in thread Determine largest key in hash
That will not work. You build a hash like this:
[0] Perl> %hash = ( 1 => { 1 => "nothing", name => "Shrek", event => "I saw shrek!", }, 6 => { 1 => "nothing", name => "Donkey", event => "I saw the donkey!", 2 => "nothing", name => "Fiona", event => "I saw Fiona!" }, );;
But end up with this:
pp \%hash;; { 1 => { 1 => "nothing", event => "I saw shrek!", name => "Shrek" }, 6 => { 1 => "nothing", 2 => "nothing", event => "I saw Fiona!", name + => "Fiona" }, }
NOTE: that in the hash key by '6' there is only one 'name', and only one 'event'.
You cannot have duplicate keys in a hash. You need to rethink your data structure.
|
|---|