Look at the preview window before you post. Your square brackets are being eaten and turned into links! Or put <code> around things.

So, you want to create a new global variable %hello because some input said "hello", right?

That's what I'm questioning the wisdom of, since it's a manditory response and I was the first to answer.

If you really want to do it, use symbolic references. to wit:

no strict refs; $x= "hello"; $$x{bar}= "foo"; print $hello{bar}; # yup, it's there.
You can read more about that in the perlref man page that came with Perl. I suggest you play around with it a little beore using it in the real program.

—John


In reply to Re: Re: Re: Complex Data Structures 2 by John M. Dlugosz
in thread Complex Data Structures 2 by immybaby

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.