file1: Box of Joe CA12DE 12345 Big Box BA23DF 0123X Small FFFFF3 111XX Big and Small 4F4FGG XCA12 None XXXXXX 00000 file2: BA23DF BA23DF 4F4FGG #### Name Number Count Box of Joe CA12DE 12345 Small FFFFF3 0123X None XXXXXX 00000 #### #!/usr/bin/perl open(F1 ") { push (@field, $line); } my $string = join(",",@field); my @f = split(/,/, $string); my @unique_f = split(/,/, unique(@f)); while ($m_line = ) { if !($m_line =~ m/????????/i) sub unique { my %seen = (); my @r = (); foreach my $a (@_) { unless ($seen{$a}) { push @r, $a; $seen{$a} = 1; } } return @r; } #I have gotten this far but now I want to use regular expression that matches each entry of the second column of file1 to the entire @unique_f. Thus, if the match is NOT DEFINED, then it should print the whole line. Thanks!