in reply to What are the core points of good procedural software design? (functions, code structuring)

Well lately I'm enclosing possible global variables in a block with the functions that use them:
{ my $var; sub func { $var=1; func2($var); } }
In most cases this approach works for me.
  • Comment on Re: What are the core points of good procedural software design? (functions, code structuring)
  • Download Code

Replies are listed 'Best First'.
Re^2: What are the core points of good procedural software design? (functions, code structuring)
by moritz (Cardinal) on Jun 23, 2008 at 10:56 UTC
    or in other words, you're turning global variables into local ones (or in perl terms, lexical vars), and subs into closures.

    That can work fine in many cases, but you should be aware of that distinction.

    Update: slight re-wording.