G'day hotpelmen,

The oldest version I have is v5.30.0, so I couldn't attempt to replicate your results. I had a look in perlform for a number of versions but couldn't find any change. My look was brief; you may want to study more closely:

I suspect you may be right about '~' & '~~'. There does seem to be some conflict between "perlform: Suppressing Lines Where All Fields Are Void" and "perlform: Repeating Format Lines".

"Assuming I still want to use format, how would you advise to overcome this and achieve printing of whitespace values into separate lines of report?"

This code, pm_11152452_testformat.pl, worked for me.

#!/usr/bin/env perl use strict; use warnings; use autodie; use constant REP_LINE_MAX_LENGTH => 3; # For demo only print "Perl version: $^V\n"; my $outfile = '/tmp/pm_11152452_test.txt'; my ($date, $reference, $rep_line); format REP_TOP = @<<<<<<<<<<<<<<< @>>>>>>>>>>>>>> $date, $reference . format REP = ^*~~ $rep_line . $date = '11/11/2011'; $reference = 'REF123'; open my $fh, '>', $outfile; $fh->format_name('REP'); $fh->format_top_name('REP_TOP'); $fh->autoflush(1); $fh->format_lines_per_page(10); for (@ARGV) { $rep_line = substr($_, 0, REP_LINE_MAX_LENGTH); write $fh; } # For demo only system cat => $outfile; unlink $outfile;

I kept REP_LINE_MAX_LENGTH very short for demo purposes; you'll want it to be 33 (if I counted correctly). I tested it on three versions:

$ ./pm_11152452_testformat.pl zero one " " two three " " four five Perl version: v5.30.0 11/11/2011 REF123 zer one two thr fou fiv $ ./pm_11152452_testformat.pl zero one " " two three " " four five Perl version: v5.32.0 11/11/2011 REF123 zer one two thr fou fiv $ ./pm_11152452_testformat.pl zero one " " two three " " four five Perl version: v5.36.0 11/11/2011 REF123 zer one two thr fou fiv

See how you go with 5.16.

— Ken


In reply to Re: perl 5.32 format question by kcott
in thread perl 5.32 format question by hotpelmen

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.