>>>>> "r" == rogers-pm5 <rogers-...@rgrjr.dyndns.org> writes:
r> From: "Uri Guttman" <u...@stemsystems.com> r> Date: Mon, 27 Sep 2010 23:15:17 -0400 r> actually the <= part is even more amusing. look here: r> perl -le '$#foo = -2 ; print $#foo' r> -1 r> ; r> you can't set the last index to < -1. which makes sense. which makes the r> original code even dumber. r> uri r> There is a school of thought that you should always use "<=" when r> testing an index against a lower bound, and ">= when testing against an r> upper bound, instead of strict equality. The idea is to guard against r> unbounded loops when a later mod to the code makes it possible to bump r> the index by 2. But this isn't a loop, "-1" is a hopelessly r> counterintuitive thing to compare to a length or index, and (as you r> point out) "#$foo" can't return anything smaller anyway. i have known that bound checking rule and i think i used it when i did lots of c. i have stopped using it mostly since i never need to do bounds checking in perl! :) r> So I'll put my money on "ignorant." (Without totally discounting r> "evil".) with some coders, those are equivilent! :) uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm