use Readonly; Readonly my $LOW => 9; Readonly my $HIGH => 14; ... my $count = $some_variable eq 'x' ? $HIGH : $LOW; for $i (0 .. $count) { ... }