![]() |
|
P is for Practical | |
PerlMonks |
Re^2: references best practiceby Haarg (Chaplain) |
on Apr 25, 2008 at 22:51 UTC ( #682947=note: print w/replies, xml ) | Need Help?? |
Your second example isn't doing what you intend. The array outside of the sub isn't modified. The first line of prepData2 sets $refData to the incoming reference. The second replaces that reference with a different one, leaving the contents of the first reference unchanged. You'd want something more like:
With that change, the benchmark changes somewhat, making it almost identical to array_ref_out1 in my tests.
In Section
Seekers of Perl Wisdom
|
|