Variables that are sequentially or similarly named are almost always a sign that they belonged in a single data structure. For example, if you had placed the data into a hash of arrayrefs:
my %data; $data{A} = [qw(a data goes here)]; $data{B} = [qw(b data here too)]; $data{C} = [qw(and here is c data)];
Then the code to compare A to both B and C could have just been a loop changing an index or key value. This is especially true if you're about to introduce D, E, F as you say in your last paragraph.

For example, here's a quick way to invert the index, and figure out which elements each item is in (presuming simple keys):

my %seen_in; for my $key (sort keys %data) { for my $value (values %{$data{$key}}) { $seen_in{$value} .= $key; } }
For "data", this will reveal "ABC". For "goes" this will be "A", and so on.

In reply to Re: Selective Check of Multiple Arrays With Single Construct by merlyn
in thread Selective Check of Multiple Arrays With Single Construct by neversaint

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.