my @arr1 = qw(a b c d e f g h); my @arr2 = qw(d a e); # needed array @result = qw(b c f g h);