http://www.perlmonks.org?node_id=1214657


in reply to Easy hash question (uninitialized value)

Also check out the function exists. It lets you test if a key is in a hash. In this case it would help you debug but it's useful in general for validating hash keys, especially when they come from user input.

I added the following at the end of your script:

if( exists $j{$number} ) { say $j{$number}; say "done"; } else { say "<$number> is not a key in \%j" }

Here is the result of running it:

C:\usr\pm\hash>perl 1214633.pl 4 4 <4 > is not a key in %j