Next: Text::Wigwam::Library::Struct | Previous: Text::Wigwam::Library::Procedure | [Table of Contents] | [Text::Wigwam Index] |
Text::Wigwam::Library::Sets #intersection, #set_minus, #symdiff, #symmetric_difference, #union
This library provides directives which are useful for performing operations on data sets.
The directives within this library can be imported into specific branches of
the directive tree (which transcends from Text::Wigwam::Directives
) via
plug-ins or modules using one of the following techniques.
package Text::Wigwam::Directives::some::arbitrary::branch; # import everything use Text::Wigwam::Library::Sets qw/:all/; package Text::Wigwam::Directives::another::arbitrary::branch; # import selectively use Text::Wigwam::Library::Sets( qw / :intersection :set_minus :symdiff :symmetric_difference :union / );
Returns an array of elements common to both array1 and array2
[!! #join ", " #intersection ( 1 2 3 4 5 6 ) ( 2 4 6 8 10 ) /* output: 2, 4, 6 */ !!]
Returns an array containing elements from array1 that are not in array2.
[!! #join ", " #set_minus ( 1 2 3 4 5 6 ) ( 2 4 6 8 10 ) /* output: 1, 3 ,5 */ !!]
Shorthand for #symmetric_difference
.
Returns an array of elements which exist in either array1 or array2, but not both.
[!! #join ", " #symmetric_difference ( 1 2 3 4 5 6 ) ( 2 4 6 8 10 ) /* output: 1, 3, 5, 8, 10 */ !!]
Returns an array containing all elements of array1 and array2 without duplicates.
[!! #join ", " #union ( 1 2 3 4 5 6 ) ( 5 6 7 8 9 10 ) /* output: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 */ !!]