in reply to Setting package variables via eval

The text $main in your eval is being taken as a variable of that name. Escape the $.

But you shouldn't need to use eval. This works for me:

my $var = 'fred'; ${"main::$var"} = 12345; ## set main::fred = 12345

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.