sub variation6 { my $idx = -1; my %hash; $hash{ $_ } = ++$idx for @array; }