in reply to constant and eval (are they enemies?)

Let's say you wanted to make CONSTANT1 be 1, CONSTANT2 be 2, and so on. This loop does the same as constant:
BEGIN { no strict 'refs'; for (1..5) { my $num = $_; *{__PACKAGE__ . "::CONSTANT$num"} = sub () { $num }; } }
It's important that $num here be a closure variable, so that all five coderefs are distinct.

You should be able to extrapolate this strategy to your application.

-- Randal L. Schwartz, Perl hacker