@a1_index{ @a1 } = 0..$#a1; #### my @a1 = ( qw(one two three four five six seven eight nine ten) ); my @a2 = ( qw(four seven nine) ); #### @indices = ( qw( 3 6 8) ); #### use strict; use warnings; use Data::Dumper; my @a1 = ( qw(one two three four five six seven eight nine ten) ); my @a2 = ( qw(four seven nine) ); my @indices; my $c=0; map { foreach my $i (@a2) { if($_ eq $i) {push(@indices, $c)}; } $c++; } @a1; print "indices DUMP:\n", Dumper(\@indices), "\n";