in reply to create arbitrarily named scalars
I'm not advocating what you want (I always suspect there is a better design that doesn't need this kind of thing), but,
The print reveals the presence of *main::foo, *main::bar, and *main::baz in the symbol table. I did that to avoid autovivifying.sub arb_scalars { eval "use vars qw/@{[map {'$'.$_} @_]}/;"; warn $@ and return if $@; 1; } arb_scalars qw/foo bar baz/; { local $, = " "; print %::; }
Your numbered sequence of variables is crying out to become an array.
After Compline,
Zaxo
|
|---|