http://qs321.pair.com?node_id=784670

hnd has asked for the wisdom of the Perl Monks concerning the following question:

can somebody explain me this:

"Since prototypes are taken into consideration only at compile time, it naturally falls out that they have no influence on subroutines references like \&foo or on indirect subroutine calls like $subref->().
method calls are not influenced by prototypes either. That's because the actual function to be called is indeterminate at compile time, depending as it does on inheritance, which is directly detrmined in perl."

Chapter 6: subroutines, Programming Perl 3/ed

a code explaining the above thing would be better....
=====================================================
i'am worst at what do best and for this gift i fell blessed...
i found it hard it's hard to find well whatever
NEVERMIND

Replies are listed 'Best First'.
Re: sub routine help
by jwkrahn (Abbot) on Jul 30, 2009 at 18:06 UTC
Re: sub routine help
by ikegami (Patriarch) on Jul 31, 2009 at 04:31 UTC

    Prototypes alter parsing rules, alter the context in which arguments are evaluated, and limit what operators appear as arguments. Since those are all compile-time effects, prototypes have no run-time effects.

    This means that $subref->() doesn't care if the referenced sub has a prototype or not.

    sub foo(\@) { ...} foo(@a); # Passes \@a my $subref = \&foo; $subref->(@a); # Passes $a[0]
Re: sub routine help
by vinoth.ree (Monsignor) on Jul 31, 2009 at 04:17 UTC
Re: sub routine help
by Anonymous Monk on Jul 31, 2009 at 04:00 UTC