#! /usr/bin/perl -w use strict; my %seen; while( <> ) { chomp; ++$seen{$_}; } print "$_\n" for keys %seen;