#!/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!