in reply to Re: Invoke a method on an object
in thread Invoke a method on an object

Since I believe he is talking about $method being a string, wouldn't the first version need no strict 'refs', and a leading ampersand?

for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";

Replies are listed 'Best First'.
Re^3: Invoke a method on an object
by Corion (Patriarch) on Jan 13, 2009 at 15:36 UTC

    No:

    perl -Mstrict -le "sub P::p{print 'p'};my $p=bless {},'P';my $m='p';$p +->$m;"

      I acknowledge that this works, and runs under "use strict"; but how is $m not a symbolic reference? I'm a little confused here.

      for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";
        Yes. It is a symbolic reference (a name instead of a "real" reference).

        Yes. It still works even under "use strict 'refs'".

        That's the way it works, and always has.