Roses-> 2" -> MA CD TH 4" -> CD TH Violets-> 3" -> MA TH etc. #### ...query statements built, etc., and get plants AOH... print "plants: ".Dumper($plants); for my $i (0..$#$plants) { $plants->[$i]{'common'} = $plants->[$i]{'common_name'}; #query the database for available sizes of the plants $sizes = $self->dbh->selectall_arrayref($s_stmt, {Slice => {}},($plants->[$i]{'id'}, 1)); print "sizes: ".Dumper($sizes); if (@{$sizes}) { $jctr = 0; for my $j (0..$#$sizes) { #j-loop print "j-loop: ". $plants->[$i]{'common'}."\n"; line 74: $plants->[$i]{'common'}->[$jctr]{'sizes'} = $sizes->[$j]{'plantsize'}.$sizes->[$j]{'unit'}; #query the database for growers with those plants $growers = $self->dbh->selectall_arrayref($g_stmt, {Slice => {}}, ($sizes->[$j]{'plantid'}, $sizes->[$j]{'plantsize'}, 1)); print "growers: ".Dumper($growers); #haven't gotten this far yet if (@{$growers}) { $kctr = 0; for my $k (0..$#$growers) { $plants->[$i]{'common'}->[$jctr]{'sizes'}->[$kctr]{'growers'} = $growers->[$k]{'two_letter_abbrev'}; $kctr++; #increase counter } #for growers } #if growers $jctr++; #increase counter } #for sizes } #if sizes } #for plants loop #### plants: $VAR1 = [ { 'genus' => 'Acer miyabei \'Morton\'', 'common_name' => 'State Street Miyabe Maple', 'type' => '1', 'chicagoland_grows' => '0', 'id' => '1063' } ]; sizes: $VAR1 = [ { 'show_plant' => '1', 'plantsize' => '1.5-2', 'plantid' => '1063', 'unit' => '"', 'userid' => '4' } ]; j-loop: State Street Miyabe Maple #### for my $i (0..$#$plants) { $sizes = $self->dbh->selectall_arrayref($s_stmt, {Slice => {}},($plants->[$i]{'id'}, 1)); if (@{$sizes}) { $jctr = 0; for my $j (0..$#$sizes) { $plants->[$i]{'sizes'}->[$jctr]{'size'} = $sizes->[$j]{'plantsize'}.$sizes->[$j]{'unit'}; $jctr++; #query just the growers with those plants, by size $growers = $self->dbh->selectall_arrayref($g_stmt, {Slice => {}}, ($sizes->[$j]{'plantid'}, $sizes->[$j]{'plantsize'}, $sizes->[$j]{'unitid'},1)); if (@{$growers}) { $kctr = 0; for my $k (0..$#$growers) { $plants->[$i]{'sizes'}->[$j]{'growers'}->[$kctr]{'abbrev'} .= $growers->[$k]{'two_letter_abbrev'}." "; } $kctr++; } } } } #### [ { 'sizes' => [ # $i - loop { 'size' => '5-6"', 'growers' => [ # $j - loop { 'abbrev' => 'KT ' # $k - loop } ] } ], 'chicagoland_grows' => '0', 'common_name' => 'Northern Pin Oak ', 'id' => '7108', 'genus' => '', 'type' => '1' }, { 'sizes' => [ { 'growers' => [ { 'abbrev' => 'KN ' } ], 'size' => '1.5-4.5"' }, { 'growers' => [ { 'abbrev' => 'HI ' } ], 'size' => '2-4"' } ], 'genus' => 'Acer nigrum \'Green Column\'', 'chicagoland_grows' => '1', 'common_name' => 'Green Column Black Maple', 'id' => '6', 'type' => '1' } ];