in reply to Pass by reference: is it good form to grope @_?

The aliasing of the elements of @_ to the actual call values is an intentional feature. It's exactly what you're looking for, so I say go ahead and use it. You may also want to use a prototype of (\$), to ensure that the calling code doesn't pass in a constant.

Of course, the documentation for the subroutine should specify that it modifies its argument in place.

  • Comment on Re: Pass by reference: is it good form to grope @_?

Replies are listed 'Best First'.
Re: Re: Pass by reference: is it good form to grope @_?
by Fastolfe (Vicar) on Dec 16, 2000 at 06:26 UTC
    The only problem with prototyping like this is that object methods cannot be protoyped, so it would have no effect. A constant would be passed, ignoring the prototype.