First off, I know that formats are not the preferred method for formatting text. What can I say, mea culpa.

However, I recently ran into a situation where the easiest way to go from problem to solution, on a one-use-script, was to use a format. However, I ran into the problem that I had to comment out "use strict" in order to get my code to compile. At least I had this problem if I used a format name other than "STDOUT"...

Is there something I am missing? Consider the following trivial code. Is there some way to use both the format and to get "use strict" to work?

#!/usr/bin/perl -w use strict; my $text1 = "A"; my $text2 = "B"; $~ = COLUMNS; write; exit; format COLUMNS = @<<<<<<@>>>>>>> $text1,$text2 .

In reply to "use strict" and formats by mrider

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.