[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] That was productive...



Sune Kirkeby wrote:
> [John Porter wrote [what happened to the attributions?]:]
> > 
> >   for ($i=0; $i < @foo; $i++) {
> >     local $e = $foo[$i];
> >     # ...
> >   }
> > 
> 
> ...using ``local'' might be considered bad
> taste, again maybe that's just me...

You should use local when you need local.
Sometimes you need local.

For a localized value of $_, you need local.
That's what was happening above.

So, at least in this case, it's not a matter of
taste.  

Now, it looks to me like the $_ in the loop got
mutated into $e.  (Who did that?)

For that, yes, you'd probably want "my $e".


> (I am aware that I am nitpicking the postings of a Perl God,
> but the use of local stings my poor eyes.)

Don't make me come down there...  ;-)


-- 
John Porter

"There are people who have fun studying the C++ spec for
literally seconds on end, I'm sure..."    John Vlissides


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe