in reply to splitting a list

Be lazy, stand on the shoulders of others. List::Compare does all that and more. (The code below has been mildly tested.)
#!/usr/bin/perl use strict; use warnings; use diagnostics; use List::Compare; my @List1 = qw(education production results); my @List2 = qw(education joe bob carl production steve results test); my @OutList1 = @List1; #Part I is done... my $lc = List::Compare->new(\@List1, \@List2); # Get those items which appear (at least once) only in the second list +. my @OutList2 = $lc->get_complement; my $n; foreach (@OutList2) {print $n++.": $_\n"};
Output:
0: bob 1: carl 2: joe 3: steve 4: test

Cheers,

Brent

-- Yeah, I'm a Delt.