use CGI; my $cgi = CGI->new(); if ( 'POST' eq $cgi->request_method() ) { # other methods: GET, HEAD }