#!/usr/bin/perl -wT use strict; use CGI; my $q = new CGI; if ( grep { /application\/xhtml\+xml/ } $q->Accept ) { print "Content-type: application/xhtml+xml\n\n"; } else { print "Content-type: text/html;Charset=utf-8\n\n"; } print 'some xhtml'; ...