I have two comments for you

I will be considering a subroutine to bypass the repetitive writing of similar code and provide a centralized chunk of code that can be invoked from anywhere within your program, this carries the advantage of making it easier to debug and trace errors, modify & enhance code later and facilitate adding more capabilities centrally that are going to be dynamically extended to the areas in the program invoking the subroutine without having to write too much code or deal with nasty inadvertent typos for instance.

You can have many subroutines organized by the theme of the activities they will be performing and if necessary they can communicate among themselves, consider this pseudocode:
#define functions in themes sub dependency_checks{ #receive arguments and perform the checks #common to the so many if statements } #write your program with the rest of the unique section.

Secondly, how do you intend to use @matches, does ordering matter to you in this case or could you avail of the flexibility that a hash based structure has where you can directly retrieve and have access to values without so much hassle, the link you provided implied that hash-based structures are more flexible.

From the overview of the concepts presented to you in http://www.perl.com/pub/2003/08/07/design2.html, familiarize yourself with the concepts and consult links such as those in Tutorials->The Uniqueness of hashes.,intro to references but I emphasize that you should go ahead learning Perl in an orderly way without jumping ahead of yourself because new knowledge needs time to solidify and if you have any doubts or questions, seasoned monks will undoubtedly spring to help, best of luck !


David R. Gergen said "We know that second terms have historically been marred by hubris and by scandal." and I am a two y.o. monk today :D, June,12th, 2011...

In reply to Re: How to implement a Design Pattern/ Strategy?? by biohisham
in thread How to implement a Design Pattern/ Strategy?? by jonc

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.