The file with the constants:
And the file using these constants.use Readonly; Readonly $test1 => 'EEN'; Readonly $test2 => 'TWEE'; Readonly $test3 => 'DRIE'
If you don't mind not using the strict pragma, you can drop the $main:: on the imported constants.use strict; do 'test.pl'; print "$main::test1 $main::test2 $main::test3"; $main::test1 = 1;
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: Clean way to export all constants at once
by CountZero
in thread Clean way to export all constants at once
by perl_help26
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |