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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |