[ABE.pm] A question

Faber J. Fedor faber at linuxnj.com
Mon May 7 19:02:04 PDT 2007


On 07/05/07 16:03 -0400, Ricardo SIGNES wrote:
> This is my guess at the real problem: you want to fill in defaults into rows.
> 
>   my %default = (
>     color  => 'red',
>     flavor => 'cod',
>   );
> 
>   for my $id (@transactions) {
>     my $actions_taken = 0;
> 
>     DEFAULT: for my $key (keys %default) {
>       next DEFAULT if $default{ $key } eq 'NULL';
>       $HASH{ $id }{ $key } = $default{ $key };
>       $actions_taken++;
>     }
>   }
> 
> ...or something like that.

What's the point of the DEFAULT label?  You're breaking out of the same
loop you're in.  Now, 



>   DEFAULT: for my $id (@transactions) {
>     my $actions_taken = 0;
>
>     for my $key (keys %default) {
>       next DEFAULT if $default{ $key } eq 'NULL';
>       $HASH{ $id }{ $key } = $default{ $key };
>       $actions_taken++;
>     }
>   }

I could understand!

-- 
 
Regards,
 
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701

http://www.linuxnj.com





More information about the ABE-pm mailing list