in reply to Global symbol x requires explicit package name at main.pl
On very rare occasion, there's a valid reason to make a package variable global (or declare it with 'our', as toolic recommended.) If you do so, then you can access it without exporting or any other special mechanisms, simply by specifying the package name:
package test; $x = "Hi"; # Or $::x = "Hi"; package main; print $test::x;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global symbol x requires explicit package name at main.pl
by beanryu (Novice) on Aug 19, 2010 at 00:56 UTC |