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.selectedIndex].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.selectedIndex].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

Reply via email to