Re: @_ aliasing



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
.



Relevant Pages

  • Re: cant read file?
    ... You're passing &ch as an argument to fcanf() ... *and* you're assigning the result to ch. ... (I'm not certain whether it invokes undefined behavior, ... Prev by Date: ...
    (comp.lang.c)
  • Re: Getting value from asp:label into javascript input value
    ... In regular asp the syntax for assigning an asp global variable to a ... javascript var is: ... Prev by Date: ...
    (comp.lang.javascript)
  • Re: Trouble inserting record...?
    ... > I am sure that I am missin' something, ... At the point that you are assigning those values, you don't have a record open to insert them into. ... It's about priorities." ... Prev by Date: ...
    (comp.databases.paradox)
  • Object instantiation and garbage collection
    ... What's more efficient from a performance/garbage collection point of ... view - assigning an object to a variable or not? ... Prev by Date: ...
    (comp.lang.java.programmer)

Loading