in reply to Understand why dumper printed null hash

By exposing $hash_ref to string context in $hash_ref =~ s/...//, the value has been stringified to contain something like HASH(0x82a8768). Try adding another Dumper after calling Clear.