Hi all, I will try to ramble this off in an understandable pattern,,, I have a table in a database, whom has 3 columns. column 0 is primary key, so we are ignoring it for this question. The first is 'setting' the second is 'value'. This table can be empty or can have values. If it is empty, the perl script knows to use the default values. If one setting is missing ,it knows to replace it with its default value.

The simplest way I can think of for the perl code to handle the settings from the table, is something like this:
while (my @prev = $sql->fetchrow_array()){ $$prev[1]=$prev[2]; }

You probably notieced, this piece of code is not valid. But it shows exactly what I want, I want the value of $prev[1] to become a new string whose value is $prev[2]. IE, if $prev[1]=ip and $prev[2]=127.0.0.1 then after exiting the loop I would have: $ip=127.0.0.1

I know some other languages allow this exact piece of code, ie PHP, ect.

Can anyone help me do this in perl? It is the only language I will use for this.

Thank you all in advance, PyroX

In reply to Dynamic Settings from Database, $$string help by PyroX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.