Any time you want to know if one value is in a set of others, you probably want a hash. Convert @b to a hash (with the values as keys), then loop on @a, checking if the values exist in %b. Here's an example:
my @a = qw(one two three four); my @b = qw(two four); my %b; @b{ @b } = (1)x@b; # one of many ways to create the hash for (@a) { unless ($b{$_}) { print "$_ is not in \@b\n" } }
In reply to Re: Need to Create an Array of Differences
by revdiablo
in thread Need to Create an Array of Differences
by scottj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |