#!/usr/bin/perl -w use strict; use CGI; # start new cgi process my $main=new CGI; # print html headers print $main->header; # print html tags and add title print $main->start_html ("Printer Status"); # open /usr/lsys/printstatus/printstatus.out under filehandle LOGFILE open(LOGFILE," /usr/lsys/printstatus/printstatus.out"); # while there is data in LOGFILE while() { # remove newlines (\n) from input chomp; # if the imput is not the divider line if (! ($_=~/----------------------------/)) { # put the contents of the current line into the array @status # we are spliting on the space so that every word seperated by # a space becomes a new element in the array my @status = split(/ /, $_); # if the first element of @status does not equal 'name' (the title header if (($status[0] eq "name") && ($status[1] eq "display")) { # print the start of the table print "
\n"; # for each element in @status for (@status) { # print a new table cell print "\n"; } # close the table row print "\n"; } } } # close the table print "
$_
\n"; # close LOGFILE close (LOGFILE); exit;