[alex@rand alex]$ perl -de 1
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(-e:1): 1
DB<1> @file1=qw/dave bob rich jim/;
DB<2> @file2=qw/dave rich/;
DB<3> foreach(@file1){$list{$_}=1;}
DB<4> foreach(@file2){delete $list{$_};}
DB<5> print "Remaining elements " . join("; ",keys %list) . "\n";
Remaining elements jim; bob
DB<6>
You can fiddle with the 'list' hash as you read the file, so there's no need to use an array as the middle man.
Alex / talexb / Toronto
Life is short: get busy!
PS: When posting code, put it in between 'code' tags. That way it doesn't wrap like normal text.
|