in reply to Re: syntactic sugar, hemlock, and other such fun
in thread syntactic sugar, hemlock, and other such fun

Please note that Masem's solution will NOT run under strict 'refs'. I personally consider this less-than-optimal, though it is a perfectly good solution.

It sounds like you're trying to do some sort of dispatch table. So, just use a dispatch table.

sub foo { print "Foo!\n"; } sub bar { print "Bar!\n"; } my %dispatch = ( foo => \&foo, bar => \&bar, ); for my $key (keys %dispatch) { print "$key ... "; &{$dispatch{$key}}; }
This has an additional benefit of not mispelling anything.

------
We are the carpenters and bricklayers of the Information Age.

Vote paco for President!