in reply to JavaScript and Perl Subroutine

JavaScript runs on the web browser's computer, perl runs on the web server. To communicate from the browser to the server you'll need to put a CGI which can run this function on command. Perhaps you'd do something like document.location = document.location.href.replace( '/.*', '/cgi-bin/allExaminations.pl?action=logout' ); in your page's JavaScript and then you have to have your CGI be able to handle the parameter you just gave it. So maybe you said use CGI; my $q = CGI->new earlier and can then say logout() if $q->param( 'action' ) eq 'logout'.