Skip Menu |

This queue is for tickets about the Array-Utils CPAN distribution.

Report information
The Basics
Id: 130076
Status: new
Priority: 0/
Queue: Array-Utils

People
Owner: Nobody in particular
Requestors: GUGOD [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.5
Fixed in: (no value)



Subject: array_diff(@a,@b) works incurrently when there are duplicates in @a
The implementation of array_diff is build a Set from @b, but not @a. When @a contains identical elements that should be excluded, only one of them is excluded. This behavior can be demonstrated with the following code: ----8<---- use v5.18; use Array::Utils qw(array_diff); my (@a, @b); @a = qw(a b c d); @b = qw(c d e f); say join ", ", array_diff(@a, @b); # a, b, e, f # "a" is duplicated @a = qw(a a b c d); say join ", ", array_diff(@a, @b); # a, b, e, f, a @a = qw(a a a a a a a b c d); say join ", ", array_diff(@a, @b); # a, a, a, a, a, a, a, b, f, e