Hi,

I'm currently extending the online help of a software system we have here. It has a normal command line where typing in 'help' spills some general help text (more or less a list of known commands with short descriptions).
Now I'd like to do something like 'help <command>' for a more detailed help. Until now, the implementation is very trivial and in my opinion error prone:

... } elsif($command eq '?' or $command eq 'find') { &message(<<'EOT'); Help menu for the command 'find': SYNOPSIS find <phrase> - find <phrase> in lexicon and output al +l meanings found. DESCRIPTION Both commands are optional. If given a phrase, it is default blahblahblah EOT } elsif($command eq 'add') { &message(<<'EOT'); Help menu for the command 'add' SYNOPSIS add <lex> <entry> - add an entry <entry> to the lexicon <l +ex> DESCRIPTION This adds an entry to the lexicon with the name/type <lex>, <entry> must have proper syntax or it will be rejected. If blahblahblah EOT ...
Now I'd like to place some variables into the here documents. E.g. the commands shouldn't be typed in explicitedly, but just the $command variable should be interpolated. HOwever, it seems to me, that here documents are a very static construct not allowing this "template mechanism".

Am I overseeing something?

Bye
 PetaMem


In reply to Interpolating in Here Documents? by PetaMem

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.