in reply to Re^4: Better way to do this
in thread Better way to do this
Of course, this does not deal with duplicates in either array, but you haven't said how they should be processed.$ perl -E ' > my @unique = (1, 20, 3, 4, 44, 55, 66, 77, 5, 10, 2, 11, 20, 42, 30, + 31, 32, 33, 34, 35, 36, 37, 40); > my @in = (4, 3, 2, 2, 42, 40); > my %lookup = map { $_ => 1 } @in; > for my $i (0..$#unique) { > say $i if exists $lookup{$unique[$i]}; > } > ' 2 3 10 13 22
|
|---|