my @aKeep; while (my $line = ) { # split line into fields - depends on how the line is formatted @aFields = .... if (!exists($hValuesInColumn2{$aFields[1]}) { push @aKeep, $line; } }