List::SetOperation - simple set operation
use Test::More;
use List::SetOperation qw/intersection union difference/;
my @intersection = intersection(
[1, 2, 3, 4, 5],
[1, 2, 3],
[1, 3]
);
is_deeply \@intersection, [1, 3];
my @union = union(
[1, 2, 3, 4, 5],
[1, 2],
[3, 4, 5],
);
is_deeply \@union, [1, 2, 3, 4, 5];
my @difference = difference(
[1, 2, 3, 4, 5],
[3, 4, 5],
);
is_deeply \@difference, [1, 2];
@difference = difference(
[
[1, 2, 3, 4, 5],
[3, 4, 5],
],
[
[1, 3],
[2, 4],
]
);
is_deeply \@difference, [5];
List::SetOperation does set operation.
Copyright (C) meru_akimbo.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
meru_akimbo merukatoruayu0@gmail.com