my %hdata = (); for my $i (0 .. $#{$table}) { print $#{$table}; ### why cant find the length of array here my $location = $table[i]->[0]; my $room = $table[i]->[1]; push $hdata{$location}=$room; }