http://www.perlmonks.org?node_id=885680


in reply to redrafted code

Move the subroutine definition to somewhere else, for example to the top of your code, before the main part of the code starts. Then call the subroutine at the point in the code where you have now defined it.

Also note that when you split a line:

Replies are listed 'Best First'.
Re^2: redrafted code
by chromatic (Archbishop) on Feb 02, 2011 at 18:12 UTC
    Move the subroutine definition to somewhere else, for example to the top of your code, before the main part of the code starts.

    Perl 5 parses the entire code before running it, so this is only relevant if your sub declaration relies on runtime effects.