in reply to Exporting variable from Module (5.005)
package I_am_an_example; use strict; use vars qw(@EXPORT @ISA); use Exporter; @ISA='Exporter'; @EXPORT=qw($jimmy $bob); $I_am_an_example::jimmy="White"; $I_am_an_example::bob="Hope"; 1;
Your require does not work because with use strict;, you need to declare the scope of your variables. To pull in the incl.pl as above, you would do:
use strict; use vars qw($test1 $test2); require ('inc.pl'); print "$test1\n$test2\n";
Also, see the faq on the differences between use and require.
|
|---|