%hash = ( foo => 'bar', bar => sub { 'foo' } ); (ref() eq 'CODE') && $_ = \$hash{ $_->() } for values %hash;