use CGI; print $foo->header; sub header{ my $self = shift; my $cgiobject = CGI->new; return $cgiobject->header(); }