SPUG: How can I find @1 - @2?
Adrian Hands
AEH at akc.org
Wed Jan 24 16:40:54 PST 2007
#!/usr/bin/perl -w
use strict;
my @students = qw{ Bashful Doc Dopey Grumpy Happy Sleepy Sneezy };
my @enrolled = @students[ 2, 3, 4 ];
my @not_enrolled;
print "Enrolled = " . join( ', ', @enrolled ) . "\n";
{
my %tmp;
@tmp{ @students } = @students;
delete( @tmp{ @enrolled } );
@not_enrolled = keys %tmp;
}
print "NOT enrolled = " . join( ', ', @not_enrolled ) . "\n";
-----Original Message-----
...
I have in @enrolled a list of enrolled students and in @students a
list of all students. How would I go about finding the contents of
@students who are not @enrolled?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20070124/3364915b/attachment.html
More information about the spug-list
mailing list