programming-examples/perl/Report/Controlling pagination.pl
2019-11-15 12:59:38 +01:00

19 lines
895 B
Perl

The $= variable holds the number of lines allowed on a page.
When the line number exceeds this amount, write outputs a new page.
$= defaults to 60.
The $- variable counts down as each line gets output on a page.
When $- gets to 0, write outputs a new page.
You can set $- to 0 to force a page output on the next call to write.
Setting $- works only if you have a top-of-page format, e.g., FILEHANDLE_TOP.
The following table lists the variables relating to pages and formats.
Variable Usage
$= Number of lines on a page; defaults to 60.
$- Number of lines left on the page.
$% Current page number.
$~ Name of format, defaults to same name as file handle.
$^ Name of top-of-page format, defaults to _TOP added to file handle.
$^L String to output to advance page, defaults to formfeed character.