Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: mod_perl and function declrations

by repson (Chaplain)
on Apr 18, 2001 at 18:38 UTC ( #73510=note: print w/ replies, xml ) Need Help??


in reply to mod_perl and function declrations

Usually the parameter context specifier is unnecessary, except in some few situations where it can be useful. It is nothing like what appears in subroutine declarations in most other programming languages and exists to provide access to syntax like core functions.
For full descriptions read perlsub, part of the standard documention supplied with perl.

  • sub foo () { ... } - This syntax is used for functions which will never take any parameters (think of functions like time which will return a value but will never recieve any input) and also for constants which will be inlined at compile time since they never change.
  • sub blah ($) { ... } - This syntax is useful for cases like this: @foo (sin $num, time, ord $chr, @array); If sin was , time and ord didn't have specific declarations then they would eat the rest of the list availible, even if they only useds 0 or 1 items of it.
  • sub blah (&$) { ... } - This type of syntax is used by map and grep to allow simple use.


Comment on Re: mod_perl and function declrations
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-10-25 19:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (148 votes), past polls