SPUG: How can I find @1 - @2?
Murray Chapman
muzzle at imdb.com
Wed Jan 24 16:28:11 PST 2007
On Wed, 24 Jan 2007, Atom Powers wrote:
> I need to find the difference between two sets of data, two arrays.
Convert one array to a hash and use it as a filter:
my @students = qw(fred peter alex john susan penny);
my @enrolled = qw(john fred peter);
my %enrolled = map {$_ => 1} @enrolled;
my @not_enrolled = grep {!$enrolled{$_}} @students;
Murray
-- Murray Chapman Zheenl Punczna --
-- muzzle at imdb.com zhmmyr at vzqo.pbz --
-- Internet Movie Database Vagrearg Zbivr Qngnonfr --
-- http://www.imdb.com uggc://jjj.vzqo.pbz --
More information about the spug-list
mailing list