#!C:/PROGRA~1/PERL/BIN/PERL.EXE -w use strict; my %count; print "Please enter the items line by line.\nEnter # to end counting items\n\n"; for (;;) { my $item=<STDIN>; chomp($item); if ($item eq "#") { last; # break; } if ( defined( $count{$item} ) ) { $count{$item}++; } else { $count{$item}=1; } } print "Listing items:\n"; { my $item; foreach $item (keys(%count)) { print $count{$item}." ".$item."s\n"; } } print "\nPress ENTER"; <STDIN>; # press ENTER to contiune