in reply to Mixed-up output
This isn't the best way to write the program, though. Instead of reading in the entire template, then printing out the pieces, it's simpler to loop for each section, and exit a loop when the next section starts:
#!E:/perl/bin/perl use CGI qw(:all); use strict; print header; open (TEMPLATE, "index.shtml") || die "cannot find index.shtml: $!"; while (<TEMPLATE>) { print; last if /^\s*<!-- MAIN -->.*$/; } while (<TEMPLATE>) { print, last if /^\s*<!-- ENDMAIN -->.*$/; } open (FORMTEMPLATE, 'form.txt') || die "cannot find form.txt: $!"; while (<FORMTEMPLATE>) { print; } while (<TEMPLATE>) { print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Mixed-up output
by Nimster (Sexton) on Jan 16, 2001 at 01:34 UTC | |
by chipmunk (Parson) on Jan 16, 2001 at 01:40 UTC | |
|
Re: Re: Mixed-up output
by repson (Chaplain) on Jan 16, 2001 at 09:14 UTC |