#!/usr/bin/perl -w #use CGI::Carp('fatalsToBrowser'); use Carp; use diagnostics; use strict; use warnings; my @pages; my @xfilenames; my @filenames; my @xtitles; my @titles; my @xheadings; my @headings; my @xstuff; my $xstuff=""; my @stuff; my @xtemplate; my $xtemplate=""; my @template; open(PAGES, "; close(PAGES); foreach $_ (@pages) { if (m/^\*{4}filename.ext\*{4}/) { push(@xfilenames, $_) } elsif (m/^\*{4}title\*{4}/) { push(@xtitles, $_) } elsif (m/^\*{4}heading\*{4}/) { push(@xheadings, $_) } else { push(@xstuff, $_) } } foreach(@xfilenames) { s/^\*{4}filename.ext\*{4}//; chomp $_; push @filenames, $_; } foreach(@xtitles) { s/^\*{4}title\*{4}//; chomp $_; push @titles, $_; } foreach $_ (@xheadings) { s/^\*{4}heading\*{4}//; chomp $_; push @headings, $_; } $xstuff = join "", @xstuff; @stuff = $xstuff =~ /\*{4}stuff\*{4}(.*?)\*{4}endstuff\*{4}/sg; open(TEMPLATE, "; close (TEMPLATE); $xtemplate = join"", @xtemplate; @template = $xtemplate =~ /^(.*?)\*{4}filename.ext\*{4}/sg; push (@template, $xtemplate =~ /\*{4}filename.ext\*{4}(.*?)\*{4}title\*{4}/sg); push (@template, $xtemplate =~ /\*{4}title\*{4}(.*?)\*{4}headings\*{4}/sg); push (@template, $xtemplate =~ /\*{4}headings\*{4}(.*?)/sg); for (my $i=0; $i < (@filenames); $i++) { open(FILE, ">$filenames[$i]") || die $!; print FILE qq($template[0] $titles[$i] $template[1] $headings[$i] $template[2] $stuff[$i] $template[3]); close(FILE); } print "Content-type:text/html\n\n"; print < create EndHTML foreach (@filenames) { print "

Name:$_

"; } print "
"; foreach (@titles) { print "

Titles:$_

"; } print "
"; foreach (@headings) { print "

Headings:$_

"; } print "
"; foreach (@stuff) { print "

stuff:$_

"; } print < EndHTML #### $_.=($=+(6<<1));print(chr(my$a=$_));$^H=$_+$_;$_=$^H; print chr($_-39); # Easy but its ok.