I don't think you've really given us enough to chew. My advice is to just get started with whatever strategy you can come up with; keep it as simple and straight-forward as you can. If that doesn't work out, I doubt you would need more than 100 lines of code before deciding to modify the approach. And if it does work out, you're done without a lot of fretting.

my %actions = ( greet => sub { print "Hello world!\n"; }, growl => sub { print "Rawwwrrrr!\n"; }, depart => sub { print "Goodbye!\n"; }, unrecognized => sub { warn "I don't know how to $_[0].\n"; }, ); while( <DATA> ) { chomp; if( exists $actions{$_} ) { $actions{$_}->(); } else { $actions{unrecognized}->($_); } } __DATA__ greet growl whine depart

...produces...

Hello world! Rawwwrrrr! I don't know how to whine. Goodbye!

Without a better understanding of what you're after, all I can provide is this sort of framework for your consideration.


Dave


In reply to Re: Discussion(maybe?) How would you do this? Modules and reading a file/dir by davido
in thread Discussion(maybe?) How would you do this? Modules and reading a file/dir by Anonymous Monk

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.