Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Subroutine Reference with use strict

by chiller (Scribe)
on Apr 13, 2002 at 20:41 UTC ( [id://158854]=note: print w/replies, xml ) Need Help??


in reply to Re: Subroutine Reference with use strict
in thread Subroutine Reference with use strict

I gave the prototype to the subroutine reference because without it, I get the "Prototype Mismatch" error, IN ADDITION TO the subroutine error.

There is not a (@) prototype?! Programming Perl 3rd ed. lists them on pg. 226. :)

Yes, it's Apache::Registry, sorry.

  • Comment on Re: Re: Subroutine Reference with use strict

Replies are listed 'Best First'.
Re: Re: Re: Subroutine Reference with use strict
by Anonymous Monk on Apr 14, 2002 at 01:32 UTC
    The prototype problem is probably because you didn't have just \&foo, rather something like \&foo(), in which case the subroutine foo would have been run, which would result in prototype mismatch. However, if you leave out the parentheses completely no subroutine call will be made and such no prototype check will occure there. If you do like Juerd and rinceWind said then you're home safe. You must realize that & is the sigil of subroutines, just like $ is the sigil of scalars. So you use & to address it, not call it. If you want to execute the subroutine then you use parentheses, but not otherwise.

    (Disclaimer to other monks: Yes, I know this is very simplified and I know about &foo and it's magical @_ treatment, but that's another issue and let's not confuse he who seeks help with almost irrelevant details.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://158854]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-20 00:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found