##
#constant declaration area at top of script
$value_1 = 14;
$value_2 = 9;
...many lines of code later...
if ($some_variable eq 'x') {
$count = $value_1;
}
else {
$count = $value_2;
}
for $i (0 .. $count) {
do some stuff
}
####
#constant declaration area at top of script
$count{'x'} = 14;
$count{'y'} = 9;
...many lines of code later...
for $i (0 .. $count{$some_variable}) {
do some stuff
}