Wisdom escapes me...as I have only just begun.

The scenario:

Got asked by my boss to translate a bunch of scripts form bash to PERL. Not a bad idea...only...the scripts are a nightmare and the program tree really could use some major pruning...we are talking a jungle being pruned back to a rosebush.

The main question I have:

I have reviewed a very poor style of inserting/formatting text within a bash script. It appears that several functions were made containing formatted text. These functions are then called when convenient to print the formated text on screen. (interactive shell scripts).

In trying to translate to PERL, I find this method inefficient, but I have not figured out a better way in PERL of doing the same...and by formatted I imply blank lines and tabbing. (not bold, italics, etc...).

The question:

Is there a lazy way, err...more wise way to output blocks of text to the stdout other than putting a block as a subroutine and calling subroutines in order as a means to "create" a pretty text readout on screen? I'd really like to utilize the same text with pod as well...so I can create help files as well as print the text on the screen when the script is run.

Any insight available is appreciated and elaboration upon request is possible.

Thank you,

-monkmoose


In reply to Text in Scripts by monkmoose

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.