Re: @_ aliasing
- From: Tim Hammerquist <tim@xxxxxxxxxxxxx>
- Date: Thu, 22 Sep 2005 19:22:06 GMT
Matija Papec <perl@xxxxxxxxxxxxx> wrote:
> "Paul Lalli" <mritty@xxxxxxxxx> wrote:
> > If you want to change the argument to f(), change it
> > directly: $_[0] = 5;
>
> Yes, no doubt about that, but I think that I've read somewhere
> how shift keeps the "magic" when operating on @_.
You probably read that, in order to avoid confusing,
hard-to-find errors involving inadvertently changing aliased
arguments, you should probably be making explicit copies of them
by assigning them to lexically scoped vars unless you're sure
you want to change the aliased variables.
Tim Hammerquist
.
- Follow-Ups:
- Re: @_ aliasing
- From: Tim Hammerquist
- Re: @_ aliasing
- References:
- @_ aliasing
- From: Matija Papec
- Re: @_ aliasing
- From: Paul Lalli
- Re: @_ aliasing
- From: Matija Papec
- @_ aliasing
- Prev by Date: Re: Can a Perl Programmer Pick up PHP quickly?
- Next by Date: Re: @_ aliasing
- Previous by thread: Re: @_ aliasing
- Next by thread: Re: @_ aliasing
- Index(es):
Relevant Pages
|
Loading