But normally the content type is at the top of the page. Does any one know how to do that?
Place your print header before anything else, and make sure it isn't in a loop unless you have some way of surpressing multiple calls...
print header;
while ( <FILE> ) {
# ...
}
while ( <FILE> ) {
# ...
print header unless $already_printed_header++;
# ...
}
However, in more recent versions of CGI, the functionality of the latter is actually built in for you, but needs to be enabled by supplying the -unique_headers argument to your use CGI...
use CGI qw/ -unique_headers /;
while ( <FILE> ) {
# ...
print header;
# ...
}
--k.