use CGI qw//; my $q = CGI->new(); print $q->header( -nph => 0, 'Content-Type' => ' text/event-stream', 'Cache-Control' => 'no-cache', 'Connection' => ' keep-alive', ); print $q->header( -nph => 1, 'Content-Type' => ' text/event-stream', 'Cache-Control' => 'no-cache', 'Connection' => ' keep-alive', ); __END__ Cache-control: no-cache Connection: keep-alive Content-Type: text/event-stream; charset=ISO-8859-1 HTTP/1.0 200 OK Server: cmdline Date: Fri, 04 Sep 2015 23:33:29 GMT Cache-control: no-cache Connection: keep-alive Content-Type: text/event-stream; charset=ISO-8859-1