http://qs1969.pair.com?node_id=107077


in reply to errors revisited

damian1301 ends it here

When run WITHOUT CGI::Carp, it gives clearer errors. This is a revised version of your script.

#!/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, "<pages.txt") || die $!; @pages = <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, "<template.html") || die $!; @xtemplate = <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 <<EndHTML; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transisional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>create</title> </head> <body> EndHTML foreach (@filenames) { print " <p>Name:$_</p>"; } print "<hr />"; foreach (@titles) { print "<p>Titles:$_</p>"; } print "<hr />"; foreach (@headings) { print "<p>Headings:$_</p>"; } print "<hr />"; foreach (@stuff) { print "<p>stuff:$_</p>"; } print <<EndHTML; </body> </html> EndHTML
NOTE that ALL errors had to do with not declaring your variables or misspeeling them. Be even more careful next time with your typing and spare us the time :).
UPDATE: Thanks bikeNomad - I just caught that myself :)

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