in reply to CGI http header error

The script you posted doesn't send anything to the standard output, therefore you get an error when you browse it. Try the following variation:
#!/usr/bin/perl use strict; use CGI; my $q = new CGI; $doc = $q->start_html('hello world'); $doc .= $q->h1('hello world'); $doc .= $q->end_html; open(OUT, '>out.html') || die "Couldn't open out file: $!"; print OUT $doc; close OUT; print $q->header(); print $doc;

This sends the HTML code both to out.html and to the standard output (that it to say, to the web browser).

The HTTP header (print $q->header()) is needed when outputting to the standard output via CGI, but you can (and maybe you'd better) not send it to the file you create. The example above works this way: the header is only sent to the browser, and the HTML file is sent both to the browser and to the file.

Michele.