in reply to How can I turn a string into a variable name?

If you really cannot use a hash (and that's easily the best way to do this), install PadWalker and use my $lexicals = peek_my(0); to get a hash reference which you can use to manipulate all lexical variables bound to the current scope.

(If manipulating Perl 5 internals from pure Perl still seems less overkill than using a hash, consider that PadWalker can read from and write to and even create lexicals in other scopes, ignoring encapsulation.)

Replies are listed 'Best First'.
Re^2: How can I turn a string into a variable name?
by Anonymous Monk on Jan 09, 2010 at 20:32 UTC
    I can use a hash. It looks like that is what I will do. I was just hoping for a slicker way. Thanks