Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://73510]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2018-06-22 23:39 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.