Another possibility is to make use of the object-oriented capabilities of perl.
Objects are a more extensible approach because you don't have to keep adding
to a dispatch table. The restriction is that the function names must be the
same, but within different packages.
use strict;
package A;
sub doit {
print "Called A\n";
}
package B;
sub doit {
print "Called B\n";
}
my $ref = [];
bless $ref,"A";
$ref->doit();
bless $ref,"B";
$ref->doit();