in reply to Style question: symref or eval?
that may not be exactly right, but it gives the idea...my %dispatch = ( test1 => \&test1, test2 => \&test2, etc.. ); if(exists $dispatch{$op}) { $dispatch{op}->($arg); }
also, you can check the definedness of subroutines...
but most people would cringe at this being a symbol table lookup.... dispatch table is a very common way to go about this...if(defined &$op)
- Ant
- Some of my best work - Fish Dinner
|
|---|