#!/usr/bin/perl use strict; use warnings; use Data::Printer; my @a = (1,2,3,4); my @b = (1,3,2,5,6); p(@a); p(@b); my %h = map { $_ => 1 } @a; p(%h); @b = grep { ! exists $h{$_} } @b; p(@a); p(@b); __END__ ergibt: [ [0] 1, [1] 2, [2] 3, [3] 4 ] [ [0] 1, [1] 3, [2] 2, [3] 5, [4] 6 ] { 1 1, 2 1, 3 1, 4 1 } [ [0] 1, [1] 2, [2] 3, [3] 4 ] [ [0] 5, [1] 6 ]