Re: Cant figure out how key's value in a hash is created in program example.............

2001-12-20 Thread Shawn
He Brian, In Perl, you don't have to declare your variables if you don't want to. You are building the count hash on the fly here. All you are doing is incrementing itself by one everytime the word is found. @words=('test','this','that','test'); for $word (@words) { $count{$word}=$count{$wor

RE: Cant figure out how key's value in a hash is created in program example.............

2001-12-20 Thread John Edwards
I'll try $count {$word} = $count {$word} + 1; The $count refers to a hash called %count. As you are working with only one element of that hash (the key/value pair with the key of $word), you reference the element as a scalar (hence the $, not %). It's still refering to the hash, but not the whol