while(){ push @array, $_; if($hash{$_}){ print "$_ was entered more than once\n"; } $hash{$_}++; }