in reply to Modifying values by reference: what works and what doesn't

The parameters in @_ are aliased to what was actually passed, so this works:
sub foo { $_[0] = { all => "new" }; }
but your my $ref = copies the reference, and the copy in $ref is not aliased. This is just like the difference between:
my %x = (foo => 0, bar => 1); my $z = $x{foo}; $z = 2;
which doesn't change the original value in %x and
my %x = (foo => 0, bar => 1); $x{foo} = 2;
which does.