in reply to Calling $function from $module

Does this help?

package fred; sub fred{ print "This is fred::fred; so good they named me twice!" };; package main; fred::fred;; This is fred::fred; so good they named me twice! $p= 'fred'; $s='fred';; &{ "$p\:\:$s" };; This is fred::fred; so good they named me twice! *{ "$p\:\:$s" }->();; This is fred::fred; so good they named me twice!

Anyone got any experience of this phone's predecessor?

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!

Replies are listed 'Best First'.
Re^2: Calling $function from $module
by Anonymous Monk on Aug 05, 2015 at 22:27 UTC
    'fred::fred'->();;

        He saying you could have used

        ( $p.'::'.$s )->()

        It's the alternate form of

        &{ $p.'::'.$s }()

        The following should be avoided since it inherits the parent's @_ rather than creating a new one:

        &{ $p.'::'.$s }

        I recommend against both of your solutions. The first (&{ $p.'::'.$s }) is wrong and the second (*{ $p.'::'.$s }->()) is weird.

        (my $fred = 'fred::fred' )->();