Have a look at Implementing Dispatch Tables in the tutorials section.
In reply to Re: subroutine refs by wfsp in thread subroutine refs by CColin