On 9/11/07, Jeff Pang <[EMAIL PROTECTED]> wrote:

> Please don't use $a and $b as variable names,they are built-in
> variables used by `sort` function.see `perldoc -f sort`.

It is true that $a and $b are special during sort. But when there's no
sorting going on, can using them cause the programmer any grief?

I can see good reasons to avoid single-letter variable names as a
matter of policy. And these two have the additional shortcoming is
that 'use strict "vars"' is less careful about ensuring that they're
declared as lexical variables. But perl was designed so that those
variables could be used outside of a sort context just like any
others; if it behaves otherwise, that's a bug.

Has anyone seen another reason to avoid $a and $b? They don't seem all
that dangerous.

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to