Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The file module1.pm :
- package module1;
- use strict;
- use warnings;
- use module2;
- sub print_var {
- print "global_var1 = ", $module2::global_var1, "\n";
- }
- 1;
- ----------------------------------
- # The file module2.pm :
- package module2;
- use strict;
- use warnings;
- our $global_var1 = 'global_var_sub';
- 1;
- ------------------------------
- # The main script:
- use strict;
- use warnings;
- use lib '.';
- use module1;
- module1::print_var();
- -----------------------------------
- # Output from running the main script:
- global_var1 = global_var_sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement