use CGI; my $cgi = CGI->new; ... print $cgi->header(-type=>'text/html', -charset=>'utf-8');