in reply to mapping 2nd array

for my $row (@{$sth->fetchall_arrayref}) { # note $row is an actual ro +w, not a number my $h = $row->[0]; $Data{$h}{$tableFts{$table}[$_]} = $row->[$_] for 1 .. $#{$row}; }
This illustrates two points: a) that it's much cleaner to use a Perl-style foreach loop if you're going to be capturing the whole array anyway, and b) that the way to get the maximum subscript of an array reference is to put braces after the $#.