vegasjoe has asked for the wisdom of the Perl Monks concerning the following question:
334 Capped 28 5034366 16777215 + NULL NULL NULL 373 Capped 28 5034366 16777215 + NULL NULL NULL
$VAR147 = '5034510'; $VAR148 = [ [ '308', 'Capped ', 210, 16777215, undef, undef ], [ '308', 'Capped ', 210, 16777215, undef, undef ], [ '308', 'Capped ', 210, 16777215, undef, undef ], [ '308', 'Capped ', 210, 16777215, undef, undef ] ]
$VAR147 = '5034510'; $VAR148 = [ [ '308', 'Capped ', 210, 16777215, undef, undef ], [ '334', 'Capped ', 210, 16777215, undef, undef ], [ '373', 'Capped ', 210, 16777215, undef, undef ], [ '291', 'Capped ', 210, 16777215, undef, undef ] ]
sub insert_carrier_values { my $array_ref = shift; my $hash_ref = shift; for my $aref (@$array_ref) { #element 3 in the Hash Key if ( $aref->[3] > 0 ) { #Load the Array of Array with all the records from the query with the +same element #3 if the Array does #not have something alreay there in postion 0 $hash_ref->{ $aref->[3] }[0] = [ $aref->[0], $aref->[1], $aref->[2], $aref->[4], $aref->[5], $aref->[6] ] unless defined( $rank{ $aref->[3] }->[0][0] ); # Same as above but now load postion # 1 if postion 0 if full $hash_ref->{ $aref->[3] }[1] = [ $aref->[0], $aref->[1], $aref->[2], $aref->[4], $aref->[5], $aref->[6] ] unless defined( $rank{ $aref->[3] }->[1][0] ); # Same as above but now load postion # 2 if postion 1 if full $hash_ref->{ $aref->[3] }[2] = [ $aref->[0], $aref->[1], $aref->[2], $aref->[4], $aref->[5], $aref->[6] ] unless defined( $rank{ $aref->[3] }->[2][0] ); # Same as above but now load postion # 3 if postion 2 if full $hash_ref->{ $aref->[3] }[3] = [ $aref->[0], $aref->[1], $aref->[2], $aref->[4], $aref->[5], $aref->[6] ] unless defined( $rank{ $aref->[3] }->[3][0] ); } } } # end sub insert_carrier_values
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loading of Complex Data Structures
by bobf (Monsignor) on Aug 25, 2004 at 21:31 UTC | |
|
Re: Loading of Complex Data Structures
by talexb (Chancellor) on Aug 25, 2004 at 20:42 UTC | |
|
Re: Loading of Complex Data Structures
by davidj (Priest) on Aug 25, 2004 at 20:29 UTC | |
by vegasjoe (Sexton) on Aug 25, 2004 at 20:48 UTC | |
by Anonymous Monk on Aug 25, 2004 at 21:23 UTC | |
by davidj (Priest) on Aug 25, 2004 at 21:25 UTC |