#!/usr/local/bin/perl
#
# Read a list of words, one per line.
# print error messages and ultimately return nonzero status if
# any two words differ only in case.
#

use strict;

use vars qw( %whash );	# word hash table: key is word forced to lower case,
			# value is first version of word actually seen.

use vars qw( $lcw );	# lowercase version of input word
use vars qw( $rc );	# return code.

$rc = 0;

while($_ = <>) {
	chomp($_);
	$lcw = $_;
	$lcw =~ tr/A-Z/a-z/;
	
	if(defined($whash{$lcw})) {
		if($_ ne $whash{$lcw}) {
			printf STDERR "%s %s\n", $_, $whash{$lcw};
			$rc = 1;
		}
	} else {
		$whash{$lcw} = $_;
	}
}

exit $rc;

