Philip Newton wrote:
> 
> Roland Corbet wrote:
> > I have a program that contains a subroutine that populates
> > variables from name-value pairs passed to it from an HTML form.
> >
> > I want to improve my scripts by defining my variables using the 'my'
> > function and perhaps 'use strict;'.  I don't think that I can
> > use the full function of strict because my code has to use
> > symbolic references in order to make the dynamic variable names.
> > For example:
> >
> > $$VARNAME = $PAIR_DATA;
> >
> > AFAIK, there's no other way around this that will work with
> > strict.

You can predefine the vrbl name and use an eval:

my $one;                # predefine

my $varname = 'one';
my $pair_data = '1';

eval "\${$varname} = \$pair_data";

print "$one\n";

-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   http://www.todbe.com/
  / ) /--<  o // //      Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/_<_</_</_    http://www.freeyellow.com/members/dbecoll/
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to