On Thursday 14 November 2002 07:21, Brian Ingerson wrote:
> Ken/Matthew, Good points. Thanks for the lessons.
Matthew, thank you for your time but I have to completely disagree with
Brian, there are no lessons in you examples (IMO).
M> $_ = is usually a BAD THING. Don't do it.
IMO wrong, $_ _is_ a variable and what you show is a simple assignement.
The variable being special changes nothing. Either one knows what one is
doing or not.
M> SWITCH: for(shift) {
Even if it's hidden, you exactly doing what you say is BAD.
M> However, since you are doing shift(),without the "last"s, you'll loop
M> forever.
Plain wrong.
M>it's safer to be explicit.
Safer is the wrong word, there is no safety involved in being explicit if
the same things happen implicitely; you run the same code anyhow.
K> local $_ = shift(); # good
k> But yeah, if you're using $_ as a regular variable simply
K> because perl lets you use it without declaring it, you're asking
K> for trouble.
IMO right.
Nadim.