in reply to Extracting a hash reference from a string
do 'stat.pl'; is just like scalar eval `cat stat.pl`; except that it's more efficient and concise, keeps track of the current filename for error messages, searches the @INC libraries, and updates %INC if the file is found.Assuming some_code.pl is
you can easily test that it does what you want:die +{ foo => 1 };
You should not fiddle with pointers. What if a future revision somewhere in a different place, likely made by a different maintainer who is not aware of your trickery, undoes the guarantee for the hash's refcount? There's a reason that module is in the Devel:: namespace. I'd be wary of any production code that uses it.do 'some_code.pl'; print ref $@ if $@; =output HASH
Makeshifts last the longest.
|
|---|