my %hash; while ( my $line = ) { print "Found another duplicate of: \"", $line, "\" in line $.\n" if ++$hash{$line} > 1; }