|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re: Replace Hash-Ref with Array-Refby tobyink (Prior) |
| on Nov 08, 2012 at 09:05 UTC ( #1002844=note: print w/ replies, xml ) | Need Help?? |
|
Technique, the first: we just assign a new reference to $ref, so that the pointer is pointing to the baz array.
Technique, the second: we actually swap the hash and array around in memory. This swaps all references to them!
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||