Using references, you can efficiently pass large amounts of data to and from a subroutine.
However, passing references to scalars typically turns out not to be an optimization at all.
Yes, several megabytes contained in the returned value is a good reason to use references. Your benchmark proves it. However if the length of returned scalar is not big than you get valuable overhead on dereferencing.
In reply to Re: Does the reference of a scalar more efficient than scalar?
by ccn
in thread Does the reference of a scalar more efficient than scalar?
by sunshine_august
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |