in reply to comparign two files

If the order of lines isn't important, then you should use hashes:
Update: refactored to use one hash and to print only the first column.
my %seen; #open DATA1 here ++$seen{$_} while (<DATA1>); #close DATA1 here #open DATA2 here while (<DATA2>) { # Print any lines that are found, that weren't in DATA1 print((split)[0], "\n") unless (defined(delete $seen{$_})); } # print what's left print((split)[0], "\n") for (keys %seen);
If this quick and dirty approach isn't what you're looking for, check out the Algorithm::Diff module.

The PerlMonk tr/// Advocate