fglock has you covered ... here is some more code that
illustrates how to pull the pieces out and use them:
use strict;
my %dispatch = (
foo => [\&foo,qw(5 * 4)],
bar => [\&bar,'HELLO'],
);
for (keys %dispatch) {
my ($sub,@args) = @{$dispatch{$_}};
print $sub->(@args),"\n";
}
sub foo {
my ($n1,$op,$n2) = @_;
return eval "$n1 $op $n2";
}
sub bar {
return ucfirst lc shift;
}
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)