[ABE.pm] Re: Printing an array

Faber Fedor faber at linuxnj.com
Mon Apr 25 11:07:32 PDT 2005


On 25/04/05 12:33 -0400, Faber Fedor wrote:
> I've created an array of arrays like this:
> 
> foreach $a (@{$ary_ref}) {
> 
>     $sum += $a->[1];
>     # let our data struct be:
>     # decile, cusip, weight, sum
>     push(@deciles, (1, $a->[0], $a->[1], $sum)) if $sum <= 10.0;
>     push(@deciles, (2, $a->[0], $a->[1], $sum)) if $sum <= 20.0 and $sum > 10;

Changing the above line to read

     push(@deciles, [2, $a->[0], $a->[1], $sum]) if $sum <= 20.0 and $sum > 10;

And now I can get at the data with the $deciles[$i][$j] syntax.

Who knew?

-- 
 
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