Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
<--- START SCRIPT -->Odd number of elements in hash assignment at reflections.cgi line 11 Odd number of elements in hash assignment at reflections.cgi line 12 Odd number of elements in hash assignment at reflections.cgi line 13 Odd number of elements in hash assignment at reflections.cgi line 14
#!/usr/local/bin/perl -w use strict; use diagnostics; use CGI qw(:standard); my $cgi = new CGI; my $old_writer; my $old_title; my $old_text; my $writer = param{'writer'}; my $title = param{'title'}; my $text = param{'text'}; my $current = param{'current'}; my $html_file ="reflections.txt"; #this filename holds the $reflection_holder variable for finsh_events. +cgi my $data_file ="reflections.dat"; #this filename holds the $data_holder variable for manipulation my $data_holder = "$writer :: $title :: $text"; #this hold the reflection in a data form with "::" delimiters my $reflection_holder ="$writer <BR><BR><Font color=green>$title</font +> <BR> <br><Font face=Verdana, Arial, Helvetica, sans-serif size=1>$t +ext</font>"; #this holds the reflection in an html format #archive_holder holds the archive reflection html format my $archive_holder = " <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-12 +52'> <meta name='GENERATOR' content='Microsoft FrontPage 4.0'> <meta name='ProgId' content='FrontPage.Editor.Document'> <title>Reflections</title> </head> <body bgcolor=#ffffff> <p><font face='Book Antiqua' color='#b5a466' size='5'>Reflections</fon +t></p> <p><font face='Book Antiqua' size='2'><font color='#B5A466'>by</font>& +nbsp; $writer </font></p> <p><font size='2'>$title</font></p> <hr> <p><font SIZE='2'>$text <P> <P></font></p> </body> </html>"; print "Content-type: text/html\n\n"; if ($current eq "ON") { print "<HR><B>This is what will be posted on the Reflections section o +f the homepage.</b><HR>\n"; print "by $writer<BR><BR>\n"; print "<Font color=green>$title</Font><BR><BR>\n"; print "$text<HR><br><br>\n"; #$text is actually the variable that con +tains the reflection #READ IN the old reflection data file before overwriting so it can be +archived open(FILE,"$data_file"); my @old_reflection=<FILE>; close FILE; foreach my $i (@old_reflection) { chomp($i); ($old_writer,$old_title,$old_text) = split(/\ :: /,$i); # this is the same as $count = $count + 1; my $count++; } my $the_title = "$old_title.shtml"; #current_holder holds the current reflection in html format for archiv +ing my $current_holder = " <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-12 +52'> <title>Reflections</title> </head> <body bgcolor=#ffffff> <p><font face='Book Antiqua' color='#b5a466' size='5'>Reflections</fon +t></p> <p><font face='Book Antiqua' size='2'><font color='#B5A466'>by</font>& +nbsp; $old_writer</font></p> <p><font size='2'>$old_title</font></p> <hr> <p><font SIZE='2'> $old_text<P> <P></font></p> </body> </html>"; #print "<br><br> $current_holder <BR><BR>\n"; #store current reflections in archive open (FILE, "+> ../../../reflections/archive/$the_title"); print FILE "$current_holder\n"; close FILE; #create new reflection text file open (FILE, "+> $html_file "); print FILE " $reflection_holder\n"; close FILE; #create new reflection data file open (FILE, "+> $data_file "); print FILE "$data_holder\n"; close FILE; print "<FORM action=/cgi-local/homepage_update/events/finish_events.cg +i method=post><input type='submit' value='Submit' name='reflections'> +</form>\n"; } else { #store just entered reflection in Archive for later use print "This will be stored in the Archive until it is used\n"; open (FILE, "+> ../../../reflections/archive/$title.shtml "); print FILE "$archive_holder\n"; close FILE; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: If statement wont branch
by BrowserUk (Patriarch) on Nov 21, 2002 at 00:49 UTC | |
|
Re: If statement wont branch
by runrig (Abbot) on Nov 21, 2002 at 00:49 UTC | |
|
Re: If statement wont branch
by thelenm (Vicar) on Nov 21, 2002 at 00:48 UTC |