in reply to Format Question

The reason that the header info is only included in the first file is most likely a consequence that your total lines of all index files are less than the value of $= (current page length - see perlvar), which defaults to 60. If not, then find the file with the 58th line (59th, something like that ;)) and you should find a header.

Top-of-Page Formats are meant for hardcopy devices, but you can achieve the results you want with a simple hack: make $= equal to the number of lines you are about to print plus 2 for the numbers of lines in INDEXFILE_TOP. Here is an example:

use strict; my ($prog,$desc,$pages,$date,$file); my @line1 = ( qq|prog desc pages data file\n|, qq|foo blah 5 bar foo.txt\n|, qq|bar blah 5 baz bar.txt\n|, qq|baz blah 5 qux baz.txt\n|, ); my @line2 = ( qq|prog desc pages data file\n|, qq|foo blah 5 bar foo.txt\n|, ); $~ = 'INDEXFILE'; write_2_file(@line1); write_2_file(@line2); sub write_2_file { $= = 2 + @_; for (@_) { chomp; ($prog,$desc,$pages,$date,$file) = split; write; # to STDOUT for this example } } format INDEXFILE_TOP = Program Description Pages Date Filename ------------------------------------------------ . format INDEXFILE = @<<<<< @<<<<<<<<<<<<<<<<<< @<<<<< @<<<<< @<<<<<<<<<<< $prog, $desc, $pages, $date, $file .
The only things that really bugs me about this code is having to hard code the number of lines in INDEXFILE_TOP. There might be a way to derive this number, i'll be on the lookout for it (anybody knows...feel free to share ;))

UPDATE: Doh! Looks like rinceWind has a much cleaner answer.

Change '$= = 2 + @_' to '$- = 0' in the above example for a more robust subroutine. rinceWind++

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)