my $q = CGI->new(); if( $q->param() ) { # call validate routine } else { # call display login routine }