Stefan Kredler wrote:
>
> I'm running a while loop with a hash several times and I
> want to use the last statement to exit the loop on a match.
> works fine.
>
> Entering the next time the while loop is exited w/o finding
> the right match. It seems the last state on exiting is still
> preserved and causes the premature exit. What do I do wrong?
> Is there some pointer for the hash I have to reset?
> It runs ok w/o the last statement...but I don't want to loop
> unnecessarily.
>
> ---8<----
> if ( $raw[3] eq ""){
> while ( ($key, $value) = each %table ) {
> if ($raw[2] =~ /$key/) {
> $raw[3] = $value ;
> last;
> }
> }
> }
> ----8<----
You don't need a while loop for this:
if ( $raw[3] eq '' ) {
$raw[3] = $table{ $raw[2] };
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]