http://www.perlmonks.org?node_id=1045433


in reply to Question about this simple CGI

G'day Chaotic Jarod,

"... it says there is a syntax error on the end_html line,"

You appear to have resolved the issue; however, you may still be wondering why the error was reported as being on the syntactically correct "$q->end_html;" line.

Take a look at perldiag and search for:

  • syntax error

    (F) Probably means you had a syntax error. Common reasons include:

This will explain why the error is often reported after the point where the actual error occurred.

In this case, Perl ignores the comment you wrote (i.e. '#ffffff);') — as it obviously has no idea you didn't mean that to be a comment — and continues parsing your code until it reaches "$q->end_html;" where it gives up having found no valid end to '$q->start_html(...'.

While you're learning Perl, you might consider using the diagnostics pragma which will provide verbose output regarding problems you encounter. Be aware that this is a debugging aid and should not be left in production code (and that would include what you submit for your project).

Finally, if you're unable to resolve the error yourself, feel free to ask but do include the full error message when you post your problem.

-- Ken