in reply to Replace the value of a hash

I Found the error, a missing $ sign in line
$value1 = $hash1{key1};. I am using use strict;, how come it did not detect that?
If there any other way to optimize my code?. thanks

Replies are listed 'Best First'.
Re: Re: Replace the value of a hash
by Anonymous Monk on Apr 02, 2004 at 00:26 UTC
    Stricture didn't catch it because it isn't an error. Perl does a nifty bit of DWIMery when you use a bareword as a hash key and just uses the string as a key, so you're creating a key called "key1".
Re: Re: Replace the value of a hash
by Anonymous Monk on Apr 01, 2004 at 22:35 UTC
    Thank you monks for giving me a better way to code it!