in reply to Re: Mixed-up output
in thread Mixed-up output

Speaks for itself, isn't perfect tho.
my $printed; while (<TEMPLATE>) { if (/<!-- MAIN -->/ .. /<!-- ENDMAIN -->/) { unless ($printed) { open FORMTEMPLATE, 'form.txt' or die "cannot find form.txt: $!"; local $_; print while (<FORMTEMPLATE>) close FORMTEMPLATE; $printed++; } } else { print; } }