#!/usr/bin/perl use strict; use warnings; my $file = '/u/home/jhart2/perl/project3Data.txt'; # Name the file open(INFO, $file); # Open the file for input my @Project3 = ; # Read it into an array my $NoOfCharsPerLine = 80; my $NoOfLinesPerPage = 100; my $RightMargin = 7; my $header = 3; my $footer = 5; my $width = 80; my $heading; for (@Project3) { if (/(SECTION)(\s)(\d+)(.*)(\3)(\.1\.)(.*)/) { $heading = $1.$2.$3.$4; print " " x (($width-length($heading))/2); } }