my ($key, $t); for $key ( 0 .. scalar(keys %array_of_lists)) { for $t ( 0 .. scalar @{$array_of_lists{$key}} ) {