Hello, I'm a Perl uber-novice and I'm trying to compare two files in order to exclude items listed on one file from the complete list on the other file. What I have so far prints out a third file listing everything that matches the exclude file from the complete file (which I'm hoping will be a duplicate of the exclude file) just so I can make sure that the comparison script is working. The files are lists of numbers separated by newlines. The exclude file has 333 numbers and the complete file has 9000 numbers.
Here's what I have so far: #!/usr/bin/perl use strict; use warnings; open(ALL, "all.txt") or die $!; open(EX, "exclude.txt") or die $!; open(OUT,'>exTest.txt') or die $!; my @ex_lines = <EX>; my @all_lines = <ALL>; foreach $all (@all_lines){ foreach $ex (@ex_lines){ if ($ex =~ /(^$all)/){ print OUT $1; } } } close(ALL); close(EX); close(OUT); I realize the nested foreach loops are ugly but I don't know enough to navigate the filehandles, which as I understand, can only be assigned to variables in their entirety as an array. Any thoughts on how this might be done? Thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/