Basically I have a hash with keys and all the values of these keys are set to zero. Then I step through my input file with the filehandle and I want to compare the filehandle to all of the keys in the hash. if there is a match, I would like to increment the value. My hash is called %seen. Below is what I have so far but it doesn't work. Do you have any ideas? Anything would be greatly appreciated. Thanks, Allison
#$inputFile="LogFile.dat"; # Opening LogFile.dat #open (INPUT,$inputFile)||die("Can't open datafile: $!"); #while(<INPUT>){ # $word = <INPUT>; # chomp $word; # if ($word ne "<END>") { # foreach (keys %seen){ # if ($word eq $key) { # $seen{'$key'}++;} # } # $word=<INPUT>; # chomp $word; # } # while ( ($key, $value) = each %seen) { # print "$key => $value\n"; # } # } #} -----Original Message----- From: David Kirol [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 11:17 AM To: Allison Ogle Subject: RE: Hash Values (again) Not sure where you are with this 'problem' (code helps) $my_hash{'the_key'}++ -----Original Message----- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 9:59 AM To: [EMAIL PROTECTED] Subject: Hash Values (again) Hi, I have a hash with all the values set to zero. I want to use the filehandle and if the filehandle matches a key in the hash I want to increment the value from zero. Does anyone know how to do this? I'm lost with hashes :( Thanks, Allison -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]