From: "Uri Guttman" <[email protected]>
Date: Mon, 27 Sep 2010 23:15:17 -0400
actually the <= part is even more amusing. look here:
perl -le '$#foo = -2 ; print $#foo'
-1
;
you can't set the last index to < -1. which makes sense. which makes the
original code even dumber.
uri
There is a school of thought that you should always use "<=" when
testing an index against a lower bound, and ">= when testing against an
upper bound, instead of strict equality. The idea is to guard against
unbounded loops when a later mod to the code makes it possible to bump
the index by 2. But this isn't a loop, "-1" is a hopelessly
counterintuitive thing to compare to a length or index, and (as you
point out) "#$foo" can't return anything smaller anyway.
So I'll put my money on "ignorant." (Without totally discounting
"evil".)
-- Bob
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm