I'm partially through chapter 2 of PP, so I thought that I'd add something to this:

Since your common array is going to have 1000 values in it, you may want to define you 1000th value before you start adding stuff to the array, in order to speed up execution time.

my @arr(); $arr[999] = ''; # or perhaps: $#arr = 999; #... insert code suggested by other perlmonks here

I'm not sure if 1000 entries on an array is enough to get a speed boost from predefining it's length, but it likely would...

Also, consider compiling to bytecode or doing a memory dump and saving it as an executable file (if it doesn't have to travel across operating systems).

Take care,
Dave.

"For fate which has ordained that there shall be no friendship among the evil has also ordained that there shall ever be friendship among the good." - Plato / Socrates


In reply to Re: Re: Design Question by David Caughell
in thread Design Question by Anonymous Monk

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.