tamaguchi has asked for the wisdom of the Perl Monks concerning the following question:
The above code doesn´t work ofcourse becouse $var is not defined in MyPackage. Is there a way to make variables superglobal so that they will be accessable from inside all used packages?#!/usr/bin/perl -w $var="GG"; Mypackage::printthis(); package Mypackage; { sub printthis { print "VAR is: $var\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Access variable from inside a package?
by rovf (Priest) on Aug 18, 2009 at 08:38 UTC | |
|
Re: Access variable from inside a package?
by dsheroh (Monsignor) on Aug 18, 2009 at 10:53 UTC | |
|
Re: Access variable from inside a package?
by JavaFan (Canon) on Aug 18, 2009 at 09:38 UTC |