Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to ask something about loops :
I have an array, and the elements consisting it are keys to a hash.
So, I go through the array and check the value of the hash for each element of the array. On first success I want to exit the loop, but if the first element of the array does not give the wanted result in the hash, I want to continue reading the array. I use 'next' to continue reading the array if I have no success, but how do I exit the loop when the first succesful match is accomplished? Do I use 'exit' or it will terminate the whole program?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: loop question...
by sub_chick (Hermit) on May 29, 2006 at 18:09 UTC | |
|
Re: loop question...
by xdg (Monsignor) on May 29, 2006 at 18:10 UTC | |
|
Re: loop question...
by GrandFather (Saint) on May 29, 2006 at 20:56 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |