Ok. I'll try to articulate this the best that I can. I have a series of 5 clusters, each comprised of 7 machines each. I need to "take action" on all of these machines, in the following order:
Cluster_1 Host 1 Host 2 Host 3 Host 4 Host 5 Host 6 Host 7

...and so on, acting on a set of hosts for each cluster, before moving on to the next cluster.

Here's a catch: I need to act on hosts 1-6 differently than host 7 and before host 7. I have my routines pretty much finished, however, I can't for the life of me figure out how to construct, then iterate sequentially through an appropriate data structure.

My idea, although I'm not sure exactly how to implement it, is to use a HoHoL.

my %clusters = ( cluster1_TS => ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], cluster1_SA => ['h7'], cluster2_TS => ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], cluster2_SA => ['h7'], cluster3_TS => ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], cluster3_SA => ['h7'], cluster4_TS => ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], cluster4_SA => ['h7'], cluster5_TS => ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], cluster5_SA => ['h7'], );

Not sure if the above even makes sense, but I'll continue.

My questions:

1. Does the above make sense, or is there another (better way) to accomplish what I need to accomplish?
2. What I need to accomplish, is to take action in EXACTLY the order portrayed in the data structure above. How can I create a looping statement for the above?
3. Assuming that the above data structure is doable, how would one populate it?

I know that this is a very (well, for me) complicated question, but any assistance would be appreciated, as my new employer needs to get this tool to QA tomorrow!


In reply to Data Structure Design by Tuna

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.