in reply to Difference arrays.

Perhaps I'm missing something, but here's what I got:
my @a = ( 1,1,1,1,1,2,2,2,3,3,4,5,6); my @b = ( 1,2,3,4,5,6 ); my @c = map { my $found = 0; my $m = $_; for (1 .. @b) { my $n = shift @b; ++$found and last if $m == $n; push @b, $n; } $found ? () : $m; } @a;

Update: OK, I think I got it to work. No hash here, so it may save more space at the expense of time.