Using grep on undefined array

Abigail abigail at
Wed Aug 14 19:18:16 BST 2013

On Wed, Aug 14, 2013 at 01:26:05PM -0400, Uri Guttman wrote:
> 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  

Well, about the only typo you can make when using $a and for strict to
not notice is to mistype $a as $b (or $_). But then, if I have my ($x,
$y), and I typo $x as $y, strict isn't coming to the rescue either. Or
if you have $fields and @fields, and mistype one for the other.

> 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  

What a silly argument. That's as silly as not drinking beer because a
16 year old [1] may copycat you.

> 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.

I presume all your demo code does all the right things, including stuff
like proper signal handling? After all, there may be a newbie that sees
your code and thinks it's fine to write code without proper signal handling.


More information about the mailing list