Try this: foreach my $number (keys %countother) { print "$number\n"; }
David -----Original Message----- From: Peter Eisengrein [mailto:[EMAIL PROTECTED] Sent: Friday, November 22, 2002 9:39 AM To: Perl-Win32-Gui-Users (E-mail) Subject: [perl-win32-gui-users] odd hash behavior The script below outputs the correct $number (hash key) but for some reason it also outputs the value. What gives? -Pete ############################### use strict; my %countother; print "File: "; chomp(my $file=<STDIN>); open(FILE,$file) || die "can't open file : $!\n"; foreach (<FILE>) { chomp($_); my @line = split(/\,/,$_); my ($number) = $line[8] =~ /\"(.*)\"/; $countother{$number}++; } close(FILE); my $count = keys %countother; print "Total of $count numbers used in ~ 1 week.\n"; print "*****************************************************\n"; print "NUMBER CALLS\n"; foreach my $number (%countother) { print "$number\n"; }