
BillKSmith
Veteran
Jul 1, 2011, 2:08 PM
Post #2 of 2
(732 views)
|
use the functions "pairwise" and then "any" in the modulle List::MoreUtils.
use strict; use warnings; use List::MoreUtils qw (any pairwise); our $a; our $b; our $c; my @a=(3, 0,-5, 6); my @b=(0,-2, 4, 3); my @c=(4, 0, 4, 3); die "pair a,b is not compatible\n" if any {$_} pairwise { !$a and !$b } @a, @b; print 'pair a,b is compatible', "\n"; die "pair a,c is not compatible\n" if any {$_} pairwise { !$a and !$c } @a, @c; print 'pair a,c is compatible', "\n"; Good Luck, Bill
(This post was edited by BillKSmith on Jul 1, 2011, 3:22 PM)
|