my %seen; while (<>) { my @parts = split /\|/; next if $seen{$parts[1]}++; print; }