fy'all'si:

> > > >     @newarray = map { local $_ = $_; s/foo/bar/; $_ } @oldarray;
> >
> > > The use of the local operator ... adds little functionality
> > > other then readabillity, seeing how the map function is
> > > in { } meaning that $_ is local to the function anyway.

Minor point:

    Note that this localizing doesn't apply to all { }. To summarize
    Jos' email to me, this should say something more like

        "because the $_ is in map's {}, it's implicitly localised".

    True, and another example of Perl just doing the right thing;
    Perl generally localizes when you'd want it to anyway.


Major point:

    Note also that the timing of the undo part of the implicit
    "localizing" is not quite the same as the undo timing of an
    explicit local. The net effect is that @oldarray gets changed
    with implicit localizing, but not with the explicit one.

Reply via email to