http://qs321.pair.com?node_id=118021


in reply to Re:{3} Strict, strings and subroutines
in thread Strict, strings and subroutines

BEGIN { my %cache; sub do_it { my $func = shift; $cache{$func} = do { local @ISA; __PACKAGE__->can("do_$fun") } unless defined $cache{$func}; $cache{$func}->(@_); } }
This does precisely what mine does. Did you mean "exists" there instead of "defined"?

-- Randal L. Schwartz, Perl hacker