in reply to Is it possible to call prepare statement with a variable of a variable?
"robust" and "variable of a variable" (which has the connotation of wielding symbolic references) are not generally two concepts that co-exist peacefully. While it may be possible to create something robust that uses symbolic references, it's a practice that 40 years of computer science have moved us away from vigorously, and for good reason. There are a few situations where symbolic refs may be exactly the right tool (and Perl does allow them), but more often than not they represent a design flaw.
Your script seems to want to carry the notion of $section as a string at one point, and $section as a variable later. Converting a string to a variable is a symbolic reference. There are better tools for that. Using a hash allows you to make the variable always be a variable, and make its keys always be strings. That's safer, and reduces the possibility of things going really wrong. It improves robustness.
Dave
|
|---|