|Pathologically Eclectic Rubbish Lister
How to use 'last' / 'next' commands to exit loop?by sara2005 (Scribe)
|on May 30, 2006 at 17:20 UTC
sara2005 has asked for the wisdom of the Perl Monks concerning the following question:
I define a hash table and an array upfront. Then, I want to read each element of the array, find if a 'key' exists in the hash table. If found, push the corresponding 'value' into a new array, if not, push the original element (read from the array) into the new array.
The program does what I expect it to do but I want to break the loop and contine with the next element in the array as soon as a match is found in
but, I am not too sure as to where to use the last or next command to break the loop as I didn't get the right results when I introduced last/next. Please help..
Here is the code:-
The Output is as follws:-