On Dec 13, 2007 1:02 AM, Steve Bertrand <[EMAIL PROTECTED]> wrote: > Rob Dixon wrote: > > Chas. Owens wrote: > >> > >> Only use the default variable with functions and operators that use > >> it by default like chomp and regexes. > > > > What's this? The Gospel according to Chas?! > > Hey now... > > Take into consideration that this is not everyone's point of view. > > Just because you (and I, and likely many other people) use the default > var in many circumstances other than what was stated, doesn't mean > Chas's opinion is wrong. > > Isn't Perl the language that claims TIMTOWDTI? > > Steve >
Yes, but I am the one making pronouncements about how people should code. Rob was just calling me on being a little pompous. I still think that use of $_ in places other than the start of a loop (with a function that uses the default variable like split, chomp, a regex, etc) is both dangerous and bad style. It is dangerous because $_ can be set by any number of things, so the farther from the place that you set it the more likely a bug will occur. It is bad style becuase $_ carries no information about what it is being used for. It is easier to give people simple rules like "only use the default variable with functions that use it by default" than to explain all of the nuances of when it adds clarity. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/