in reply to syntax in the sub
No, I do not advise using different names in the sub from the ones used in the main part of the script. The whole point of lexically scoped names is that a name in one scope does not interfere with a name in a different scope. The programmer can stop worrying about where else a name may have been used, because it doesn't matter.
Instead of
my $day; foreach $day(@ALL_WEEK_DAYS){ ... }
you should declare your loop variable as part of the foreach statement:
foreach my $day(@ALL_WEEK_DAYS) { ... }
|
|---|