in reply to Re: Determine largest key in hash
in thread Determine largest key in hash
Hi.
Thank you for the response. I can give an overview of what I'm trying to do.
Pretend have a loop
However for the 6th time through the loop we have TWO events. That is why I need to numerically index them because I never know.. maybe an event happens in my code and I need to create a third or fourth event for iteration 6 and I need them ALL to work properly.
So the numerics are only for use in determining which iteration to come out on, and then they are used to allow me to use as many events as necessary (the event names in the real code are NOT unique so I would not be able to use the names of them. Numbers were the only thing I could think of to make this work.
Thank you for the response. I can give an overview of what I'm trying to do.
Pretend have a loop
At every iteration I need to check to see if I have an "event trigger" in the hash. If I do, I need to print it. I can't do a simple hash because each iteration (of the counter) COULD have more than one event trigger.my $cnt = 0; while(1) { $cnt++; #print event trigger from hash }
So on our first iteration we'd get triggered that we found Shrek. Sweet! It works well because we only had the one event.my %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!" }, );
However for the 6th time through the loop we have TWO events. That is why I need to numerically index them because I never know.. maybe an event happens in my code and I need to create a third or fourth event for iteration 6 and I need them ALL to work properly.
So the numerics are only for use in determining which iteration to come out on, and then they are used to allow me to use as many events as necessary (the event names in the real code are NOT unique so I would not be able to use the names of them. Numbers were the only thing I could think of to make this work.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Determine largest key in hash
by MidLifeXis (Monsignor) on Oct 04, 2011 at 17:56 UTC | |
Re^3: Determine largest key in hash
by BrowserUk (Patriarch) on Oct 04, 2011 at 18:02 UTC |
In Section
Seekers of Perl Wisdom