use CGI; my $q = CGI->new; if ($q->request_method() eq "GET") { # do something print $q->redirect("http://somewhere.org/"); exit; }