in reply to variables names used to define variables

Why not just:
my %vars = ( list => $ENV {LIST_VAR} // $ENV {LIST_VAR_DEPRECIATED} // "other_list", source => $ENV {SOURCE_VAR} // $ENV {SOURCE_VAR_DEPRECIATED} // "other_source", ); sub var_from_env_var { my $input = shift; $vars {$input} // $input; }
No evals, no symbolic references, just plain and simple.

Abigail

Replies are listed 'Best First'.
Re: Re: variables names used to define variables
by Sandy (Curate) on Dec 11, 2003 at 01:32 UTC
    Yeah, that ought to work.

    But sometimes just having fun is worth it too

    How else can I learn the strengths and weaknesses of a particular method if I don't try it out?

    But it all honesty, I didn't think of your way.

    Still new to all of the Perl Possibilities. (FORTRAN doesn't have hashes, pointers, foreach, or...)

      You may also find useful a post from liz: defined or: // and //=, because you will need to patch your perl to use the // operator...

      Ciao, Valerio