@Zonelist = ("@WGLZAL","@WGLZAU","@WGLZBL","@WGLZBU", "@WGLZCL","@WGLZCU","@WGLZDL","@WGLZDU");

I really don't like lists of named arrays being used when a hash is a more convenient solution.

my %zonelist; foreach my $zone ('AA'..'ZZ') { my $key = 'WGLZ' . $zone; $zonelist{$key} = [ 'TRUE', 'FALSE' ]; }

or...

my %zonelist = map { 'WGLZ' . $_, ['TRUE','FALSE'] } ( 'AA' .. 'ZZ' );

Of course using an anonymous array holding two strings, "TRUE" and "FALSE" is more of a memory hog than the same anonymous array holding two numeric values: 1, and 0. And even that's more of a hog than a simple scalar value, containing the string "10". ...and that's more of a memory hog than a simple scalar value containing the numeric value of 0, 1, 2, or 3.

In other words, you could replace the anonymous array holding "TRUE" and "FALSE" with a numeric representation like this:

NUMERIC | VAL1 | VAL2 --------+-------+--------- 0 | FALSE | FALSE --------+-------+--------- 1 | FALSE | TRUE --------+-------+--------- 2 | TRUE | FALSE --------+-------+--------- 3 | TRUE | TRUE --------^-------^---------

...and that is starting to look a lot like a job for vec.


Dave


In reply to Re: Novice flails arrays by davido
in thread Novice flails arrays by wa4otj

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.