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) { ... }