develooper Front page | perl.beginners | Postings from February 2002

RE: LISTBOX Problem

Thread Previous
From:
Troy May
Date:
February 6, 2002 06:58
Subject:
RE: LISTBOX Problem
Message ID:
LOBBINEJDCHCGAJGGIFCKEFJDEAA.tmay@sierrasoho.org
The first line of here-docs should end with a semi-colon:

print <<END;
blah, blah, blah
END

Try that.


-----Original Message-----
From: Mike [mailto:mtpratt1971@hotmail.com]
Sent: Wednesday, February 06, 2002 6:28 AM
To: beginners@perl.org
Subject: LISTBOX Problem


I am trying to populate a list box in a form with using the following
script and it works fine doing it this way:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<TITLE> Current Weather Products</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
#print "<select name=\"select\">\n";
print "<form name=\"form\">\n";
print "<select name=\"radar\"
onChange=\"window.location=document.form.radar.options[document.form.radar.s
electedIndex].value\">\n";

print "<option value=\"\">Zone Forecasts</option>\n";
chdir("/var/www/html/members/wx/zfp/") || die "Cannot chdir to
/var/www/html/members/wx/zfp/ ($!)";
while (<*>) {
        print "<option
value=\"http://www.myserver.com/members/wx/zfp/$_\">$_</option> \n";
        }
</select>\n
</BODY>\n
</HTML>\n
END


Here is the problem. If I change it to this:


#!/usr/bin/perl
print "Content-type: text/html\n\n";

print<<END
<HTML><HEAD>
<TITLE> Current Weather Products</TITLE>
</HEAD>
<BODY>
<form name=\"form\">
<select name=\"radar\"
onChange=\"window.location=document.form.radar.options[document.form.radar.s
electedIndex].value\">

<option value=\"\">Zone Forecasts</option>
END

chdir("/var/www/html/members/wx/zfp/") || die "Cannot chdir to
/var/www/html/members/wx/zfp/ ($!)";
while (<*>) {
        print "<option
value=\"http://www.myserver.com/members/wx/zfp/$_\">$_</option> \n";
        }

print<<END
</select>\n
</BODY>\n
</HTML>\n
END

It errors out Can someone help me with this?

syntax error at ./listfiles.pl line 13, near "chdir"
  (Might be a runaway multi-line << string starting on line 4)
BEGIN not safe after errors--compilation aborted at ./listfiles.pl line
14.


Thanks Mike


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About