First of all, thank you all for your time and your help!!!!!!.
The above code with eval worked for us and we will search more about this method before using it (specially after reading about arbitrary code execution...) or perhaps export the Array contents to a "readable" format (XML, ini, etc.).
for (my $i=0; $i<$n; $i++) { my $value = $pizzas[$i]; $value = eval $value if $value=~/^\$\w+$/; print $variables "$pizzas[$i]=$value\n"; }
Perl is new for us, until a few months ago we were working only with VBS but we have been "gifted" with an obsolete Perl project (with "random" surprises as dirty code, few debugged, unuseful functions...).
Our goal is, by first, that Perl works hand by hand with VBS and gradually migrating platform 100% to VBS (it's a boss decision, not ours, you know... hehe).
Changing arrays to hashes would be possible, but also would be a long-term "mining" work because we have 300+ different "subprojects", with around 30 .pm each, calling functions from one to anothers (a very funny spiderweb), and one of these 30 .pm is containing the variables array that would be useful for us, those variables in the array could contain Windows environment variables ($ENV{USERNAME}...) (those scripts will only be executed under Windows plattform) or also the absolute path, UNC, strings, numeric, etc. And after changing them to hashes the hard work would be to adapt functions used in those scripts working with this "previous arrays", probably this effort won't be worth because one of these days (or years) the actual "Perl plattform" would be working 100% under VBS.
In reply to Re^2: Working with arrays of variables
by perl_noobs
in thread Working with arrays of variables
by perl_noobs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |