You can make sure variable initialization code is executed at compile time with either a BEGIN{} block or with use constant . . ..
Your initialization code itself looks fine to me. Even if there is a clever way to generate some of the pairs, it's probably better to avoid anything tricky. Init code is only run once. That opinion might change if there are a gazillion pairs in the hash.
After Compline,
Zaxo
In reply to Re: code that runs at module loading
by Zaxo
in thread code that runs at module loading
by spurperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |