|Perl Monk, Perl Meditation|
Re: Key-Board Interactive Perl Applicationby roboticus (Chancellor)
|on Dec 12, 2012 at 11:30 UTC||Need Help??|
Whew! I wrote the symbolic reference example, but didn't post it. Here are a couple alternatives:
You can use brute force:
If you're using a more modern perl the brute force method could look like:
However, a better method is a dispatch table. There's a little more setup work at the beginning, but as you add new command handlers, you'll find it's easier to maintain:
When your only tool is a hammer, all problems look like your thumb.