in reply to Does the reference of a scalar more efficient than scalar?

As said in Perl Cookbook

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.

  • Comment on Re: Does the reference of a scalar more efficient than scalar?