#!/usr/bin/perl use strict; use warnings; use List::Compare; use Data::Dumper; my @array1 = (1,2,3,4,5); my @array2 = (4,5,6,7,8); #my $lc = List::Compare->new( '-u', \@array1, \@array2); my $lc = List::Compare->new( \@array1, \@array2); my $compare = { 'Union' => [ $lc->get_union ], 'Intersection' => [ $lc->get_intersection ], 'Difference' => [ $lc->get_unique ], 'Sym_diff' => [ $lc->get_symmetric_difference ] }; $Data::Dumper::Indent = 1; print Dumper($compare);
$VAR1 = { 'Intersection' => [ '4', '5' ], 'Sym_diff' => [ '1', '2', '3', '6', '7', '8' ], 'Difference' => [ '1', '2', '3' ], 'Union' => [ '1', '2', '3', '4', '5', '6', '7', '8' ] };
In reply to Re: tweaking of perldoc function (sorting/preserving order)
by poolpi
in thread tweaking of perldoc function (sorting/preserving order)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |