return \@array or @array

James Laver james.laver at
Thu Sep 12 17:32:13 BST 2013

On Thu, Sep 12, 2013 at 5:05 PM, Jérôme Étévé <jerome.eteve at> wrote:
> I'm still not quite sure about the real benefit of return \@array though.

There isn't one. In fact, there are downsides to using it if you don't
need it, like accidentally modifying in two places where you only
wanted to modify in one. Python passes by reference by default and I
see a lot of code that makes a shallow copy to avoid such bugs. So
passing by value helps eliminate a whole category of programming bug.

In any case, it's an interpreted programming language. Write bits that
have greater performance requirements in XS. Or don't write them in
perl at all.


More information about the mailing list