in reply to Re:x3 Using $_ as a temp var, especially in functions
in thread Using $_ as a temp var, especially in functions
Unfortunately in Perl nearly everything can do invisible things that might play around with $_. You think something like $x + $y is safe? Wrong if $x is an object that overloads '+' operator. Or do you think that, say, hash access is safe? Again it may be not if hash is tied. Besides to my taste map and grep constructs often are much more ideomatic than corresponding for construct that I simply don't want to rule out function calls because my code will be less pretty.
In my opinion there is no excuse for not localizing $_ in a low level code.
--
Ilya Martynov, ilya@iponweb.net
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support
UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re:x3 Using $_ as a temp var, especially in functions
by IlyaM (Parson) on Aug 07, 2003 at 07:34 UTC |