
young twig
New User
Oct 24, 2003, 2:50 PM
Post #1 of 9
(375 views)
|
Bear with me, I'm 13 and just starting this. THis is my first PERL script, but for some reason it won't work. This is how it should work: There's a file called news.html which the PERL script writes to. It is included in the actual news page via SHTML. Simple... or so I thought. Everytime I get this error: Premature end of script headers. I've tried the permissions crap a thousand times... What's wrong? This is the script: #!/usr/bin/perl $newslist="/home/young/public_html/news.html"; if (ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; } FORM{$name} = $value; open (NEWSLIST,"<< $newslist"); print NEWSLIST "<div class="head">$FORM{date}</div>\n\n"; print NEWSLIST "<div class="news">$FORM{news}</div>\n\n"; print NEWSLIST "<BR><BR>\n\n"; close (NEWSLIST); &done; } sub done { print "Content-type: text/html\n\n"; print <<"EndPage"; <HTML><HEAD><TITLE>Thepointyouth.com v02.1</TITLE> <link rel="stylesheet" type="text/css" href="/misc/tpcss.css"> </Head> <body> <CENTER> <BR><BR> <div class="body"> <BR><BR> Thank you for adding news. If you made a mistake, email twig to have it fixed... </body></html> EndPage exit(0); } Please don't give me another script that will do what I want. I want to know is what is wrong and how to fix it. Thank you.
(This post was edited by young twig on Oct 24, 2003, 2:53 PM)
|