in reply to Modifying values by reference: what works and what doesn't
This alternative will keep the caller's hash intact, but replace ALL of its contents with a completely new set of contents, consisting of one key/value pair. This will also work even if the caller's hash is actually a blessed reference; the existing blessing is not broken (desecrated?) by this method.sub foo { my $ref = shift; %$ref = ( all => new ); }
--
[ e d @ h a l l e y . c c ]
|
|---|