Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: Defining a sub within a sub: OK?

by ikegami (Pope)
on Oct 15, 2009 at 01:19 UTC ( #801256=note: print w/replies, xml ) Need Help??


in reply to Re^3: Defining a sub within a sub: OK?
in thread Defining a sub within a sub: OK?

If a subroutine is defined after it is called, the call has to use parenthesis.

Not quite. If a subroutine is declared after it is called, the call has to use parenthesis. You can always define it afterwards.

>perl -wle"sub foo; foo; sub foo { print 'Hi!' }" Hi!

Granted, it's very rare for a subroutine to be declared somewhere other than when it's being defined.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2019-06-26 17:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (110 votes). Check out past polls.

    Notices?