say for do { # <-- mixed paradigms -------- my %seen; # <-- reinventing the wheel | grep { not $seen{ $_ } ++ } # <--------------------------- map { ( split m{;} )[ 1 ] } # too much logic, but that's nitpicking <$inFH>; };' #### use List::Util qw(uniqstr); say join "\n", uniqstr map { $_->[0] } map { [ split m{;} ] } <$inFH>;