On 08/14/2013 01:03 PM, Abigail wrote:
> On Wed, Aug 14, 2013 at 12:35:19PM -0400, Avishalom Shalit wrote:
>> wait, aren't $a and $b special ?
>> (they magically live for {$a<=>$b} etc. )
>>> They are only special in special cases. Outside of that, they are as
> friendly as your other variable.
>> People who pipe up upon seeing some code that uses $a and $b for
> illustrative purposes, predicting hell and doom even if there's no sort
> in that code behave like mindless grasshoppers, incapable of thinking for
> themselves. They probably also argue one shouldn't take water with you
> in a desert, because more people drown in water than in any other liquid.
$a and $b are never checked under strict. so using them outside of sort
can lead to bugs from typos and such. in the right circles using them
for demo code is ok but newbies (who seem to like single letter names
which is bad in general) will use them in real code and could get
trapped. i say it is better not to use them in demo code for that
reason. it is just good training (and not to use single letter names
anyone except for maybe $i, $j, $x, $y in proper context)
use $foo and $bar for demo code as those are strict checked and the
classic metasyntactic names.
uri
--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com