in reply to Dynamically Calling a Subroutine

when I added this:
use strict;
It gave an error.
Can't use string ("update_test") as a symbol ref while "strict refs"

Replies are listed 'Best First'.
Re^2: Dynamically Calling a Subroutine
by BrowserUk (Patriarch) on Jul 12, 2011 at 23:56 UTC

    Then use:

    my $result = do{ no strict 'refs'; *{ 'update_' . $n }->() };; hi

    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.