in reply to Calling a sub-routine in CGI

As DamnDirtyApe has started to allude to, you cannot use a hyperlink to call a subroutine. A perl subroutine is encapsulated within the CGI process. An HTML hyperlink is simply another way of requesting a web "object", where an object can be any manner of hosted files... text/html, images, cgi scripts, etc. However, the execution of said scripts does NOT happen within Apache's process... a separate perl process is started to handle the cgi task; only the output of the script is returned to Apache for output to the requestor (browser).

Assuming you want the script to perform some function as defined by a subroutine, I suggest you create a URL with custom or hidden parameters, which, when read in by the cgi, understands to run the appropriate subroutine. Example:
#/usr/bin/perl -w use strict; use CGI qw(:standard); my $cgi = CGI->new; if ($cgi->param()) { if ($cgi->param('toggle_on')) { &toggle_on; } elsif ($cgi->param('toggle_off')) { &toggle_off; } else { &default; } } else { # print form print $cgi->a({href => "/cgi-bin/script.cgi?toggle_on=1"}, "Toggle + On"); # print more stuff }
Hope this helps!

-fp