in reply to Re: Re: Re: Re: Re: List::Compare
in thread List::Compare
my @ary1 = qw/1 2 3 4 5 4 6/; my @ary2 = qw/5 6 7 8 7 9 10/; my %h; $h{$_} .= "a" for ( @ary1 ); $h{$_} .= "b" for ( @ary2 ); compare( "Only in ary1", "a\$", \%h ); compare( "Only in ary2", "^b", \%h ); compare( "Common to both", "ab", \%h ); sub compare { my ( $text, $regex, $hash ) = @_; print join "\n", $text, grep { $$hash{$_} =~ /$regex/ } keys %$has +h; print "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: alternative to List::Compare
by McMahon (Chaplain) on Mar 26, 2004 at 15:37 UTC | |
|
Re^2: alternative to List::Compare
by jkeenan1 (Deacon) on Jun 04, 2004 at 14:48 UTC | |
|
Re: Re: alternative to List::Compare
by QM (Parson) on Mar 26, 2004 at 22:27 UTC |