What would be your method of choice to solve OP's problem?
My code is susceptible to a lot of errors, I'm aware, I hope it never gets used "as is" in production code. :) 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.
Also, it's extremely inefficient to use the compiler for this kind of thing
If i'm not mistaken and understand it right, the contents to a string form of eval are not known at compile time, and when the interpreter does get around to compiling and evaling the string, it is executed in the same way statically typed code (if that's the right term) is. So I'm not sure I understand what you mean. Can you please clarify?
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. It definitely is faster. Sriram Srinivasan has a section in
advprog that deals with
Using Eval for Efficiency to construct faster regular expressions amongst other useful things.
perl -e '$,=$",$_=(split/\W/,$^X)[y[eval]]]+--$_],print+just,another,split,hack'er