use MyPackage; use strict; ... open_file('LOG', 'log.txt'); while (<$LOG>) { print; } # yields the following: Global symbol "$LOG" requires explicit package name at ./moduletest.pl line 21. Execution of ./moduletest.pl aborted due to compilation errors.