in reply to Problem calling a function with name stored into scalar

Try:

sub fred{ print 'this is fred:' . "@_" ; };; $f = 'fred';; &{ $f }( 1,2,3 );; this is fred:1 2 3

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Problem calling a function with name stored into scalar
by tj_thompson (Monk) on Jun 10, 2011 at 22:56 UTC
    That seems to be what I'm doing. I've tried adding the braces around the $func var like so:
    print STDERR "(\&\$func) TRUE!\n" if &{$func}(42, 1);
    But it doesn't seem to matter. Same error. This is from a larger piece of code, obviously, so perhaps something strange is going on behind the scenes.