Why is undef turning into an empty string?

perl

Solution

All hash keys are strings. Non-string values used as hash keys are coerced to strings, and `undef` becomes `''` in that context.

Problem

``` use strict; use warnings; use Data::Dumper; my %h; my $undef = undef; $h{''}='test2'; $h{$undef} = 'test'; print Dumper (\%h); ``` Creates the following output: ``` $VAR1 = { '' => 'test' }; ``` Why is this happening? I have Perl 5.12.3. Thanks for your time.

Original source