> Just a quick note; dont use $a and $b as named
> variables.. they're 'special' (used by the cmp
> operator) so to avoid ambiguity, use something
> else/more descriptive... or use $c if it makes you happy =)

Indeed, I meant to mention something about $a/$b myself.

cmp isn't really relevant.

$a and $b are sometimes used by Perl as globals that
get aliased to some other values in your program. So,
Perl will occasionally futz with the values of $a and $b,
and, if you modify $a or $b, there's a chance that you
will clobber some other value you care about. The
simplest rule to follow is, don't use $a and $b outside
of a sort sub or block.

See perldoc -f sort for more.

Reply via email to