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

Re: [PBML] Creating variables from thin air

Expand Messages
  • Greg Webster
    The line below that says: $$adminemail = $FORM{adminemail} should say: $adminemail = $FORM{adminemail} Thanks! ... -- The world s as ugly as sin, and almost
    Message 1 of 4 , Apr 11, 2000
    • 0 Attachment
      The line below that says:

      $$adminemail = $FORM{adminemail}

      should say:

      $adminemail = $FORM{adminemail}

      Thanks!

      On Tue, 11 Apr 2000, Greg Webster enscribed:
      > 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...
      >
      > Thanks!
      >
      > Greg
      >
      > --
      > "The world's as ugly as sin, and almost as delightful"
      > - Frederick Locker-Lampson
      > Greg Webster - greg@... - http://www.geekrights.org
      > Public PGP key: http://www.geekrights.org/pgp/public.txt
      > -------------------------------------------------------------
      > LINUX DRIVER PETITION - http://www.libranet.com/petition.html
      >
      > ------------------------------------------------------------------------
      > Enter to WIN one of 10 NEW Kenmore Ranges!
      > Only at sears.com
      > http://click.egroups.com/1/2677/1/_/12898/_/955502231/
      > ------------------------------------------------------------------------
      --
      "The world's as ugly as sin, and almost as delightful"
      - Frederick Locker-Lampson
      Greg Webster - greg@... - http://www.geekrights.org
      Public PGP key: http://www.geekrights.org/pgp/public.txt
      -------------------------------------------------------------
      LINUX DRIVER PETITION - http://www.libranet.com/petition.html
    • Tom Barron
      ... How about this? foreach $key (keys(%FORM)) { eval( $$key = $FORM{$key} ); }
      Message 2 of 4 , Apr 12, 2000
      • 0 Attachment
        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}\"");
        }
      • 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 3 of 4 , Apr 12, 2000
        • 0 Attachment
          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.