[sf-perl] passing array and hash references
rdm at cfcl.com
Fri Sep 29 00:18:45 PDT 2006
At 11:10 PM -0700 9/28/06, Quinn Weaver wrote:
> Rich, I have a novel solution to your problem. It combines
> the minimal code changes of the dereferencing approach with
> the semantics of references. Also, it complies with
> warnings and strictures.
My subscription to this list keeps on paying for itself...
Thanks, Quinn (as well as the Man With Too Many Initials :-).
> It requires that you modify only the subroutine call
> t_alias (\@array, \%hash); # Use references, not globs.
I don't see that this requires any change to the calling code.
Although the _receiving_ code no longer uses typeglobs, the
_calling_ code uses the same syntax it did before:
This is great stuff, Quinn! Now, before I go dancing in the
streets, are there any caveats about performance, safety, etc?
FWIW, the IMPLEMENTATION and KNOWN ISSUES sections of the docs
are slightly scary, but indicate that this is pretty robust:
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume rdm at cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development
More information about the SanFrancisco-pm