my @a = (43,43,44); my @b = (43,43); my %h = map {($_=>1)} @a; delete @h{@b}; print join(",",keys %h);