foreach my $i ( 0..$#data ) { push @{ $dataPos{ $data[$i] } }, $i; print "$data[$i] -- > $i\n"; }