Re-updated with even fewer typos!

You could store the format in a string like thus:

use vars qw( %format ); BEGIN { $format{GRID} = <<'FMT1'; format GRID = -------------------------------------------------------- @>>>: @<<<<<<<<<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<< $prefix_text, $left_text, $right_text -------------------------------------------------------- . FMT1 } #look ma, three different block closing methods all #in a column down the left side, yay!

using the local variable names you prefer and putting the format all the way at the bottom as you prefer. You do wind up with one global format storing hash but oh well.

Then when in scope with the variables you are using in the format you do this:

eval $format{GRID}; die "Oops eval wasn't happy with $format{GRID},\n$@" if $@;

Lordy it's scary stuff and if you have to eval inside a loop it will suck more but it gets what you want and is sort recommended in the Camel2 on pg. 126-7.

--
$you = new YOU;
honk() if $you->love(perl)


In reply to Re: Format with Args at End of Script by extremely
in thread Format with Args at End of Script by Carl-Joseph

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.