in reply to Why? (each...)

{ A => "b" }
creates a hash and returns a reference to it, like
do { my %anon = ( A => "b" ); \%anon }

So you are doing

my %anon = ( A => "b" ); my %keys = \%anon;

When you assign to a hash, it expects a list of key-value pairs. You just provide one item, so it's use as a key and undef is used as a value. (This would have given you a warning if you had them on!)

So you are doing

warn("Odd number of elements in hash assignment"); my %anon = ( A => "b" ); my %keys = ( \%anon => undef );

To return the contents of a referenced hash, you need to dereference it.

my %keys = %{ { A => "b" } };

But there's no reason to construct the anonymous hash at al. You could just use

my %keys = ( A => "b" );