in reply to Mini-rant about 'strict'
This is why I structure any sizable program like this:
# # Load global modules and constant data here # sub foo { . . . } sub bar { . . . } { # Main code block }
Nothing of real consequence will run until that main code block, and that block keeps variables strictly scoped. On occasion, I need some static data for a specific subroutine, which I create like this:
{ my %hash = ( bar => 1 ); sub foo { . . . } }
This structure guarentees that the hash will be filled and in scope, without having to resort to BEGIN tricks.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
|
|---|