I would tend to modularize this sort of script at least to
the extent of using subroutine calls within each of the
major "mode" blocks, so that the overall scope of mode
choices is presented compactly and clearly in the "main".
Whether the mode-specific subs are stored in separate source
code files may be a question of optimizing load time, or may
just be a matter of stylistic preference, but in any case,
the path to writing code that is minimal, optimal and
easy to re-use begins with proper factoring, and factoring is
mostly a matter of decomposing and organizing the program
logic into functional (or methodical) blocks -- i.e. subroutines.
(Officianados of OO would probably phrase it differently, but
the overall thrust of the idea would be equivalent, I think.)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.