in reply to Idiomatic Perl

You don't need the if because if $increment isn't defined yet, its value will be 0, therefore   $total += $increment; will still equal   $total.

- - arden.

update: I agree with Limbic~Region, I was simply making the case for adding up numbers based on the existence or non-existence of a variable.

Replies are listed 'Best First'.
Re: Re: Idiomatic Perl
by Limbic~Region (Chancellor) on Mar 02, 2004 at 18:20 UTC
    arden,
    I disagree if you are trying to avoid Use of uninitialized value in addition (+) at.... You also will have a problem if it is defined but not numeric. See my solution below.

    Cheers - L~R