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
In reply to Re: Setting package variables via eval
by BrowserUk
in thread Setting package variables via eval
by metaperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |