Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by ikegami (Patriarch)
on Oct 15, 2009 at 01:19 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://801256]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found