@a = (1,2,4); @b = (1,2,3,4); my %seen; for (@a) { $seen{$_}++; } for (@b) { print "$_ was in \@b but not in \@a\n" unless $seen{$_}; }