in reply to how to remove duplicate based on the first column value

my %seen; my @data = grep { chomp; not $seen{(split /\|/)[0]}++ } <DATA>;

This solution will load the entire file in at once, so if you are using large files this would not be the most memory efficient solution.

Whenever you need to remove elements from a list of items think grep.