A better step would be to place refs to the correct subs in different packages in a hash and use those as a dispatch table. Of course if you do that you'd probably be better off going the OOP route and make classes and use inheritence (or something like the State or Strategy pattern) to vary behavior.
my $dispatch = { foo => { bar => \&foo::bar, baz => \&foo::baz }, quux => { bar => \&quux::bar, baz => \&quux::baz } }; $dispatch->{ $type }->{ $operation }->( @args );
In reply to Re: Local Subroutines
by Fletch
in thread Local Subroutines
by sweetblood
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |