On 20 Sep 2000, Russ Allbery wrote:

> About the only piece of code of mine that this would affect are places
> where I use ++ on an undef value, and that's not a bad thing to avoid as a
> matter of style anyway (usually I'm just setting a flag and = 1 would work
> just as well; either that, or it's easy enough to explicitly initialize
> the counter to 0).

Depends. While it is possible to initialise counters in the canonical
"have I seen this before" situation, it's more convenient the way it is at
the moment:

    $seen{$word}++;

looks, to me, nicer than

    $seen{$word} = (exists $seen{$word}) ? 1 : $seen{$word} + 1;

or

    if(defined($seen{$word})) { $seen{$word}++ } else { $seen{$word} = 1 }

or similar.

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>

Reply via email to