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

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.