As for the types of characters in the array that could cause mayhem, could you point me in the direction of them? I'd very much appreciate that.
How about this:
my @array = ('system("rm qq(/tmp/*)")', '};die#');
This is only slightly serious, but it does show the complications you'll get into if you can't trust your input. You could probably prevent a lot of nastiness by making sure every value is correctly quoted, but that would also make the whole thing less efficient.
I'm aware of the dangerous implications of eval"" but I also have an inclination to think that evaling code for constructing other code/data structures might be more effecient than running through various loops and conditional constructs and assigning to references to get a structure constructed.
That's true, but you'd better be sure that the data is in exactly the right format or you can end up with all kinds of bugs. I'm not sure that the perl parser is actually faster than a good "custom parser" if you have a relatively stable data structure.

Sriram Srinivasan has a section in advprog that deals with Using Eval for Efficiency to construct faster regular expressions amongst other useful things
Yeah, but regexes aren't data, they're code. The advantage of compiling code on the fly is that you can then reuse the compiled code. That's when you get the real speedups. Even though the perl parser is pretty fast, if you're generating data, that means you'll have to run all the data through the compiler.


In reply to Re^4: Building Multi-Level Hash dynamically by Joost
in thread Building Multi-Level Hash dynamically by Anonymous Monk

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.