in reply to Using variables in require file... not possible?

I've separated subroutines into several files that I load into the main script using require
That sounds like Perl 4-style, around 20 years behind the curve. Place your subroutines into one or more modules. Make each module testable in isolation. To put that to the proof, write some unit tests for each module. See perlmod and Test::More.

I have some global variables that I define in the main script, and that are used throughout the sub-scripts
Global variables are evil. Ruthlessly eliminate them. Clearly define the inputs and outputs of each of your subroutines. With that done, eliminating the nasty globals should be a doddle.

I heard, for the first time, that it's good practice to "use strict"
In addition to "use strict", add "use warnings".

  • Comment on Re: Using variables in require file... not possible?