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"; } }
In reply to Access variable from inside a package? by tamaguchi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |