in reply to Re: Writing Plugin-Able perl scripts
in thread Writing Plugin-Able perl scripts

To call a subref, use $subref->(args).

Note, however, that the keys of a hash are always plain strings; they can't be references. If you try to use a ref, you'll end up getting the stringified version, which can never be reconstructed into a real reference. (Well, that isn't strictly true, but is close enough.)

So what you probably want to say is more like:

foreach (values %FunctionHash) { $return = $_->($data); }


Confession: It does an Immortal Body good.

Replies are listed 'Best First'.
Re: Re: Re: Writing Plugin-Able perl scripts
by fglock (Vicar) on Sep 03, 2002 at 02:17 UTC
    $return = &{$_->($data)};

    is  & optional here?

    update: do you mean  &{$_{$data}} or even  &{$data{$_}} ? I think the last one looks better.