the array is populated in the following manner
eval(" push \@reg_map${page_counter},\[\"\$var01\",\$var00,\"$var02 +\"\]");

Eek. So you have something like @reg_map00,@reg_map01,@reg_map02,..?

Whenever you are tempted to add a counting suffix to any variable, use an array instead: No need for eval then:

push @{$reg[$page_counter]}, @var;

Think of eval as a costly subshell under the control of you program in its own sandbox1. Setting that up only to push to an array is overkill, convoluted, difficult to read and maintain.

Whenever you are tempted to use variables using a stem and a suffix, e.g. $some_foo, $some_bar, $some_baz - use a hash instead:

%some = ( foo => ..., bar => ..., baz => ..., ... );

This makes your code cleaner, more readable, more maintainable, and it makes constructs like your eval push unnecessary.

1) Not quite a sandbox proper, since even string eval gets the surrounding lexicals, let alone (package) globals.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re: Writing indexed arrays in to an file and then retrieved by shmem
in thread Writing indexed arrays in to an file and then retrieved by perlmuser

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.