in reply to complaint: always testing defined()

The construction I use (after invoking GetOpt to return $flag) is:

            $flag = 0 if !$flag;

I'm certain there are better ways (and I look forward to reading about them).

Replies are listed 'Best First'.
Re^2: complaint: always testing defined()
by oha (Friar) on Nov 02, 2007 at 09:57 UTC
    $flag||=0; is faster :)

    Oha

      It also has the grace of shaving 7 characters off ones golf score... 8-)
Re^2: complaint: always testing defined()
by FunkyMonk (Bishop) on Nov 03, 2007 at 01:42 UTC
    This is one of the rare instances where I'd find unless more acceptable
    $flag = 0 unless $flag;

    Update: s/ flag/ $flag/