#!/usr/bin/perl -w use strict; $==shift || 60;# Set lines per page $^='H';# Set header format %_=map{$_,0}('S'..'U'); # Make a list formats my $title=<>; # Set title to first line of input doc # Header format format H= Page: @>>>> $% @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> `date` @|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| $title @|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| '=' x (length($title)-1) # that or chomp $title . # Section format format S= SECTION @# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $_{S}, $_ ================================================================================================== Use box indicate outcome. . # Test section format format T= @>>>>>>>>>>>>> @#.@# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 'TEST',$_{S},$_{T}, $_ . # Item section format format U= @>>>>>>>>>>>>>>>>>>>> @#.@#.@# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[ ] 'STEP',$_{S},$_{T},$_{U}, $_ . for(<>){ # until EOF chomp; # strip newline ($_,$~)=/:/?($',$`):($_,'U'); # choose format and output line. /\w/ or next; # if it's empty, move on. $_{$~=~/S/?'T':'U'}=0 if $~!~/U/; # Reset the next section counter in order $_{$~}++; # increment section counter write; # output template }