here
page:
print <<END_OF_HTML <HTML> <HEAD> <TITLE> $title_string </TITLE></HEAD> <BODY> <H3> $header </H3> <HR> <SCRIPT> function is_Alpha( c ) { if ( ( c >= 'A' ) && ( c <= 'Z' ) ) return true; if ( ( c >= 'a' ) && ( c <= 'z' ) ) return true; return false; } function is_Digit( c ) { if ( ( c >= '0' ) && ( c <= '9' ) ) return true; return false; } </SCRIPT> </BODY> </HTML> END_OF_HTML ;The start and stop lines are
print <<END_OF_HTML
and
END_OF_HTML
;
Of course you can use any string of text, not
just END_OF_HTML
, to delimit the "here" output. Note that
the terminating
string, in this case END_OF_HTML
, *must* start in column 1,
but all other text between the start and stop lines
can begin in any column. The strings that start with
a "$" are variables that are evaluated as the document is transmitted.
There are a few cases where certain characters need to be escaped. For example, "\n" or "\t", which might appear in JavaScript code, must be escaped with a "\", e.g., "\\n" or "\\t". If you fail to do this you will get "end-of-script" warnings when you run the CGI program.