in reply to formatting question

perltidy produces essentially the same formatting that you have.

Another option is:

my $doit; if ($wrongDateFlag) { $doit = 1 if scalar @ARGV >= 3; } else { # end date is correct if ($oneDayFlag == -1) { $doit = 1 if scalar @ARGV >= 3; } else { $doit = 1 if scalar @ARGV >= 2; } } if ($doit) { ... }

Replies are listed 'Best First'.
Re^2: formatting question
by apl (Monsignor) on Jun 24, 2008 at 17:35 UTC
    Minor tweaks...
    my $doit; if ($wrongDateFlag) { $doit = 1 if scalar @ARGV >= 3; } else { # end date is correct $doit = 1 if scalar @ARGV >= (($oneDayFlag == -1) ? 3 : 2 ); } if ($doit) { ... }
      Now I'm getting silly...
      my $doit = scalar @ARGV >= ($wrongDateFlag ? 3 : (($oneDayFlag == -1) + ? 3 : 2 )); if ($doit) { ... }
        You can factor it even a little more:
        my $doit = scalar @ARGV >= ($wrongDataFlag || ($oneDayFlag == -1) ? 3 : 2); if ($doit) { ... }