use CGI; my $q = new CGI; # do a whole bunch of stuff print "header printed!" if exists $q->{'.header_printed'};