Here is something that took me a while to get.
If you are writing scripts in Perl to do some reports and statistic analysis, and you are not using
format, stop right now, do a
Then, in case you need to switch reports in the middle of the script, for example if your script dumps the data collected in three different layouts, use this code between each report:
$~ = 'REPORT_NAME'; $^= 'REPORT_NAME_TOP'; $= = 100; # Number of lines on each page $- = 0; # Force the print of the new header
use English and use the long versions of these variables. See
perldoc perlvar for those.
$- is the one that had me pulling my hair. If you switch to a new layout and start writing data, the system doesn't know that this is a new layout, and will not print a header until he needs to switch the page. Setting this variable to 0 forces a page feed, and forces the new header to be printed.