in reply to Hash keys reference

The question has already been answered, but I'd like to point out that even if it were possible, \%hash{'key'} wouldn't be working. You want a single element, a scalar, so it'd be \$hash{'key'} instead.

Let's cheat!

If you want the references in the hash assignment for readability, and don't use anonymous subs in it, you could abuse those:
%hash = ( foo => 'bar', bar => sub { 'foo' } ); (ref() eq 'CODE') && $_ = \$hash{ $_->() } for values %hash;

Same goes for any type of reference. So if you don't use anonymous arrays, you could use:
%hash = ( foo => 'bar', bar => [ 'foo' ] ); (ref() eq 'ARRAY') && $_ = \$hash{ $_->[0] } for values %hash;

You could of course cheat using some common prefix of which you're sure not to use it for any other purpose:
%hash = ( foo => 'bar', bar => 'REF:foo' ); /^REF:(.+)/ and $_ = \$hash{$1} for values %hash;

Or just replace the hash assignment with a lot of key assignments:
%hash = (); for ( [ foo => 'bar' ], [ bar => \$hash{foo} ] ) { $hash{ $_->[0] } = $_->[1]; }

Or use a temporary hash:
%hash = (); %temp = ( foo => 'bar', bar => \$hash{foo} ); $hash{$_} = $temp{$_} for keys %temp;


BTW: I'm not really being serious.

++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
    - Whreq