>>>>> "JD" == John Delacour <johndelac...@gmail.com> writes:
JD> At 16:39 -0500 13/09/2011, Chris Stinemetz wrote: >>> From Learning Perl book: >> >> In some circumstances, $a and $b won't need to be declared, because >> they're used internally by sort. So if you're testing this feature, >> use other variable names than those two. The fact that use strict >> doesn't forbid these two is one of the most frequently reported >> non-bugs in Perl. JD> Hmm. I wonder if Randall would explain why he considers it a non-bug JD> for them to escape the pragma outside the context of sort. I must say JD> I have only discovered it just now because I generally use more JD> descriptive names for variables, but it seems to me very bug-like. nope. it is done that way for speed. perl passes the pairs of sort args in $a and $b in the globals rather than on @_ as it is much faster. since sort is a speed thing they did it this way. it is well known that those vars are excepted from strict and why when they are seen outside sort, reviewers will admonish it. you can always do my $a and it will be just a lexical. but single letter var names are bad in general (other than MAYBE $i and $j, etc. for indexing). here is another good reason to stay aways from single letter var names. they are hard to search for as other vars which start with those letters will also be found. uri -- Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com -- ------------ Perl Developer Recruiting and Placement Services ------------- ----- Perl Code Review, Architecture, Development, Training, Support ------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/