Hi Jerry.
I'm struggling to make sense of this. This is as far as I have got.
You have the following variables
$id (constant for the purposes of this question)
A source hash %DAT with keys qw(good_setups pin height).
A derivative hash %pin with keys qw(order depth).
The hash %pin is extracted from hash %DAT with the following code:
Jerry Preston wrote:
>
> for $j ( 1..20 ) {
> for $i ( 0..$DAT{ good_setups }{ $id } ) {
> $pin{ order }{ $i }{ $j } = $DAT{ pin }{ $id }{ $i }{ $j
> }{ 0 } if $DAT{ pin }{ $id }{ $i }{ $j }{ 0 } > 0;
> $pin{ depth }{ $i }{ $j } = $DAT{ height }{ $id }{ $i }{ $j
> }{ 0 } if $DAT{ pin }{ $id }{ $i }{ $j }{ 0 } > 0;
> }
> }
Which simplifies to this:
for $j ( 1..20 ) {
for $i ( 0..$DAT{ good_setups }{ $id } ) {
my $pin = $DAT{ pin }{ $id }{ $i }{ $j }{ 0 };
my $height = $DAT{ height }{ $id }{ $i }{ $j }{ 0 };
if ( $pin > 0 ) {
$pin{ order }{ $i }{ $j } = $pin;
$pin{ depth }{ $i }{ $j } = $height;
}
}
}
And you say you need translated into an array of arrays @data in this format
> my @data = ( [ '01', '02', '03', '04', '05', '06', '07', '08',
> '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19',
> '20', ], [qw/ 15 15 15 16 16 18 18 19
> 21 22 22 22 23 23 24 25 25 26 26 27/ ],
> [qw/ 15 15 16 16 17 18 19 20 21 21
> 22 22 23 23 24 24 24 24 24 25/ ],
> [qw/ 21 21 22 22 23 24 24 25 25 27
> 29 29 29 30 31 31 32 32 36 37/ ],
> [qw/ 15 15 16 16 16 17 17 18 18 19
> 20 20 21 21 23 23 23 23 23 24/ ],
> [qw/ 18 18 19 19 19 20 22 22 23 24
> 25 25 26 27 28 28 28 29 29 30/ ],
> [qw/-11 -11 -11 -10 -10 -9 -8 -7 -6 -6
> -3
> -3 -3 -2 -2 -1 -1 -1 1 4/ ],
> [qw/-11 -11 -11 -8 -8 -8 -8 -7 -5 -4
> -3
> -3 -1 -1 -1 0 1 2 4 13/ ],
> [qw/-11 -11 -11 -10 -9 -9 -8 -7 -6 -6
> -3
> -3 -3 -2 -2 -1 -1 0 0 1/ ],
> [qw/ 9 9 10 10 10 11 11 12 13 16
> 17 17 17 19 20 20 20 36 39 49/ ],
> [qw/ 6 6 6 6 6 7 8 9 10 11
> 12 12 13 14 15 15 15 16 17 17/ ],
> [qw/ 5 5 6 6 6 7 8 9 9 10
> 12 12 14 14 14 15 15 16 16 17/ ],
> );
>
..which has me flummoxed. I would guess that element zero of @data
is equivalent to the list of $j values in your first example
(but zero-padded to 2 characters)? I would also guess that elements
1 onwards of @data correspond to the list of $i values. But what the
values in the anonymous arrays are I cannot tell.
Could you try to explain this in English to give us a better handle
on what you want?
Thanks,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]