Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] Creating variables from thin air

Expand Messages
  • Dan Boger
    On Wed, 12 Apr 2000 08:14:54 -0500 Tom Barron wrote ... or this (without the eval): foreach $key (keys %FORM) { ${$key} = $FORM{$key};
    Message 1 of 4 , Apr 12, 2000
      On Wed, 12 Apr 2000 08:14:54 -0500 Tom Barron <tbarron@...> wrote
      concerning 'Re: [PBML] Creating variables from thin air ':
      > Greg Webster wrote:
      > >
      > > Weird situation...
      > >
      > > I have a script which right now creates an array like:
      > >
      > > $FORM{adminemail}
      > > (where adminemail is the key to a value)
      > >
      > > I would like to convert all of these to
      > >
      > > $adminemail
      > >
      > > ...without going through the steps in the script to say
      > > $adminemail = $FORM{adminemail}
      > >
      > > ...since there are quite a HUGE number of these built from an HTML form.
      > >
      > > Suggestions on simplifying the process would be appreciated...
      >
      > How about this?
      >
      > foreach $key (keys(%FORM))
      > {
      > eval("\$$key = \"$FORM{$key}\"");
      > }

      or this (without the eval):

      foreach $key (keys %FORM) {
      ${$key} = $FORM{$key};
      }


      Dan
    Your message has been successfully submitted and would be delivered to recipients shortly.