in reply to a question about working with the forms and array
I did want to add something. Perl has an handy feature sometimes called HERE documents. They work just like quotes but even better. They start with: << followed by a string. They end with the same string at the begining of a line. (see example below.)
Using this, you can encapsulate the entire HTML page you intend to return in one quoted chunk. Small pieces of the page can be included as perl variables that you constructed previously. Virtually none of the characters in the HERE block need to be escaped, exception for $ signs (any others?). Doing this makes your code MUCH easier to read. This technique amounts to a quick, crude Templating system -- a good thing, but that's another post. In the example below I use "MESSAGE1" as my string:
#!/usr/bin/perl # UNTESTED use CGI; use strict; use warnings; # do some processing here # create my output strings # IN real life these would be do something real... my $myTable = "some HTML string"; my $myOtherTable= "some HTML string"; # # Print the HTML # print CGI::header; print <<MESSAGE1; <html> <body> <center> <table border=0 cellpadding=0 cellspacing=0 width=600> <tr> <td align="left"><img src="img/citi.gif" width=150></td> <td align=right><img src="img/travelers.gif" height=60></td> </tr> </table> $myTable $myOtherTable ... lots of HTML deleted from here for brevity ... </center> </body> </html> MESSAGE1
-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday
|
|---|