123456789101112
use strict;my @original = qw/1 3 2 4/;my @kopie = qw/3 2 1 4 2 3 2 1 4/;for my $v (0..$#original) { print "$v ($original[$v]) Element: ", join(" & ",grep($original[$v]==$kopie[$_],(0..$#kopie))),"\n";}_ _ END _ _0 (1) Element: 2 & 71 (3) Element: 0 & 52 (2) Element: 1 & 4 & 63 (4) Element: 3 & 8