my %hash; while () { $hash{$_}++; } while ( my($key,$value) = each %hash) { print $key if ($value == 1); }