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


in reply to Easy hash question (uninitialized value)

The solution, as others have said, is to use chomp to strip the newline characters from the input. But how could you have known that was the problem?

When it doesn't make sense to you, add more debugging!

my $number = <STDIN>; say ">$number<";

Hope this helps!


The way forward always starts with a minimal test.