in reply to require "shared.pl" with use strict;

In general, when you are working with multiple files, and importing variables between them, you will find that requiring files ends up getting a bit complicated as your project grows. This is due to everything sharing a common namespace, but with some variables declared in some files but not others.

The usual way this is resolved in Perl is to create modules, and then import from those modules.


All is well. I learn by answering your questions...
  • Comment on Re: require "shared.pl" with use strict;

Replies are listed 'Best First'.
Re^2: require "shared.pl" with use strict;
by 5plit_func (Beadle) on Feb 20, 2015 at 01:23 UTC
    From the error message posted. I believe the compiler is complaining that some variables where not created using the my() operator, Hence that error. Make sure all variables or those that need to be lexical are declared using the my() operator. I believe that would save you alot of stress because you have said (use strict) hence those errors. Also make sure there are no conflicts between your variable names and those imported from other modules or required file names. Thats my little thought base on the posted error message. Hope this helps. Should i be wrong please correct me.