Unfortunately I don't have the time to refractor your ruleset into code at the moment, however I may be able to answer some of your questions.

1. How can I create a scheme that can handle hashes with varying number of arrays (values)?

To determine the number of rows and columns contained in a given matrix, find the number of hash keys and the number of referenced array elements respectively.

scalar keys %hash; # rows scalar @{ $hash{'element'} }; # columns

2. I also have difficulty in implementing point 6 above. Don't know what's the construct to build.

This is by no means a definitive answer, but one possibility is to create a lookup "table" of the same dimensions. If a match is made, place a flag in the lookup, therefore reducing checking for prior matches to a mere lookup.


In reply to Re: Aligning Arrays Problem by eibwen
in thread Aligning Arrays Problem by monkfan

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.