http://www.perlmonks.org?node_id=442198

mrider has asked for the wisdom of the Perl Monks concerning the following question:

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 .