greetings monks I have a bit of a quandry in a program I am writing I need to be able to read data from a flat file into some scalars, but once i began to approach the problem my only idea left me with the name of my scalar in side of a scalar with no idea what to do with it.

i shall try to explain that again so that i am hopefully more clear. i have a file with data in it like $data = stuff. and i need to figure out how to assign stuff to $data without knowing it is $data that i am processing but knowing that the thing to the left of the equals sign is $data.

i could have a giant long sent of if statements but i would rather not do that as i have about 100 or so things to read in from this file every time my front end for the script begins, which while not frequently is occasional enough that i would rather not do it that way (and it would take a hell of a lot of time to code in)

so does anyone have an elegant solution or do i begin coding ifs?
thanks for your time
jcpunk


all code is tested, and doesn't work so there :p (varient on common PM sig for my own ammusment)

In reply to dynamic scalar names? by jcpunk

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.