Hi.
Thank you for the response. I can give an overview of what I'm trying to do.
Pretend have a loop
my $cnt = 0;
while(1)
{
$cnt++;
#print event trigger from hash
}
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 %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!"
},
);
So on our first iteration we'd get triggered that we found Shrek. Sweet! It works well because we only had the one event.
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.