I guess no one really has an answer for this so I'll have a go ...

I think that $FORMAT_LINES_LEFT is only relevant if you happen to specify the FILEHANDLE_TOP format for your handle. In your case, you need STDOUT_TOP. That's why it wraps to 999999 rather than 60. In any case this feels like a bug.

And I don't think that $FORMAT_LINES_LEFT actually starts at zero. I think it starts life as undefined which, of course, numifies to 0. Perl probably checks for the undefinedness of this variable so that you can have the first page headerless and longer than all of the rest if you want to. Then from that point on it sets $FORMAT_LINES_LEFT = undef if $FORMAT_LINES_LEFT < 1; because I think the undefined value in $FORMAT_LINES_LEFT is what triggers the output of the header (FILEHANDLE_TOP) and causes perl to set $FORMAT_LINES_LEFT = $FORMAT_LINES_PER_PAGE -number of lines in header - 1 (The -1 is for the line just printed (the first line))

Caveat lector of course as I'm just guessing. It's been many many many years since I've actually used formats. (I believe perl4 was the perl du jour when last I used them). I'm sure there's some simpler explanation, but since I can't think of it, this will give someone else target good target practice :-)


In reply to Re: $FORMAT_LINES_LEFT question. by duff
in thread $FORMAT_LINES_LEFT question. by Anonymous Monk

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.