in reply to global variables defined in an external file
Really, the question to ask is how many are the global variables? I know it's good practice not Export variables, but if it must be done, you can do: The pm file:
The file which uses the pm filepackage Def; use warnings; use strict; use vars qw(@ISA @EXPORT $foo $bar $boo); BEGIN{ require Exporter; Exporter->import(); } @ISA = qw(Exporter); @EXPORT = qw($foo $bar $boo); 1;
#!/usr/bin/perl use warnings; use strict; use Def; # the variable defined module $foo = 'you can\'t foo me'; $bar = 'Let\'t meet in the bar'; $boo = 'The fans boo you today'; print $boo,$foo,$bar;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: global variables defined in an external file
by choroba (Cardinal) on May 06, 2013 at 15:58 UTC | |
|
Re^2: global variables defined in an external file
by fionbarr (Friar) on May 06, 2013 at 15:52 UTC |