in reply to calling a sub routine from a scalar

&{$exception->{action}}(args); should do fine

Update You can also do

local(*foo) = \&{$exception->{action}}; &foo(args);
if you want, temprarily globbing your subroutine ref to the name foo... either way works...

Update2 My bad, just realized I needed \ in front of &{$exception->{action}}; to make it work... all fixed
                - Ant

Replies are listed 'Best First'.
Re: Re: calling a sub routine from a scalar
by cmilfo (Hermit) on May 16, 2001 at 21:06 UTC
    Actually, the problem with this is $exception->{action} cannot be dereferenced, as it is a string.
      but perl can call a subroutine by name from a string, or a variable, if you do ${'foo'}, perl sees a string so tries to look at the value of $foo. Same thing goes for subroutines... slower, but very handy.
                      - Ant