khwilliamson has asked for the wisdom of the Perl Monks concerning the following question:

I have the name of an in-scope lexical variable in a string. Is there any way to get a pointer to that variable? Thanks in advance

Replies are listed 'Best First'.
Re: string to lexical variable
by GrandFather (Saint) on Jun 21, 2009 at 04:20 UTC

    Yes, but don't! Instead use a hash or other technique. Show us the code you are using and describe the problem you wish to solve (not the 'variable by name' problem, but the bigger picture) and we will show you a more reliable and understandable solution.


    True laziness is hard work
Re: string to lexical variable
by Anonymous Monk on Jun 21, 2009 at 04:19 UTC
        No? They work without eval