Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
If i exclude the if statement and the relevant { or } the script displays the contents of hours.txt but as soon as I use the if statement the 500 Internal Server Error is displayed.#!/usr/bin/perl #$myname="Merlin"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (tim +e + ($timediff * 3600)); @months = ('01','02','03','04','05','06','07','08','09','10','11', +'12'); $month = $months[$mon]; print "Content-type: text/html\n\n"; if ($month==11){ undef $/; open (FILE, 'hours.txt'); print <FILE>; close FILE; }
I have searched the monastary and from the examples I have found I thought I had got the syntax correct. Perhaps I have looked at this for too long and can't see the obvious errors. Hopefully someone can spot my problem and offer a solution and set me on the path to enlightenment.
Many thanks for any help that may be offered
Julian
Edit by castaway, fixed closing code tag, added some p tags.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: If/else problems
by JamesNC (Chaplain) on Nov 18, 2003 at 23:36 UTC | |
|
Re: If/else problems
by castaway (Parson) on Nov 18, 2003 at 23:32 UTC | |
|
Re: If/else problems
by Roger (Parson) on Nov 18, 2003 at 23:49 UTC | |
|
Re: If/else problems
by !1 (Hermit) on Nov 18, 2003 at 23:37 UTC | |
|
Re: If/else problems
by injunjoel (Priest) on Nov 19, 2003 at 01:02 UTC | |
by Nkuvu (Priest) on Nov 19, 2003 at 15:24 UTC | |
|
Re: If/else problems
by Paulster2 (Priest) on Nov 19, 2003 at 03:15 UTC | |
|
Re: If/else problems
by tfrayner (Curate) on Nov 19, 2003 at 12:21 UTC | |
|
Re: If/else problems
by bschmer (Friar) on Nov 19, 2003 at 14:42 UTC | |
|
Re: If/else problems
by Anonymous Monk on Nov 19, 2003 at 08:01 UTC |