O
okey
I have a package midway in a perl script. I that package there is a
global at the top called varTwo. No matter what I do, I can access
within the package. Why doesn't the below work? Also tried my, our
and no package name at all.
Thanks.
#================================== begin file here
my $varOne = 'This is var 1.';
print qq{This is var one: $varOne\n}; # prints fine
my $p = new MYPACKAGE();
#=== a package
package MYPACKAGE;
$MYPACKAGE::varTwo = 'This is var two';
sub new {
my $class = shift;
my $self = {};
bless($self, $class);
my $t = $FU::varTwo;
print qq{Inside packet, var two is:$MYPACKAGE::varTwo\n}; #
prints, but no value
return $self;
}
global at the top called varTwo. No matter what I do, I can access
within the package. Why doesn't the below work? Also tried my, our
and no package name at all.
Thanks.
#================================== begin file here
my $varOne = 'This is var 1.';
print qq{This is var one: $varOne\n}; # prints fine
my $p = new MYPACKAGE();
#=== a package
package MYPACKAGE;
$MYPACKAGE::varTwo = 'This is var two';
sub new {
my $class = shift;
my $self = {};
bless($self, $class);
my $t = $FU::varTwo;
print qq{Inside packet, var two is:$MYPACKAGE::varTwo\n}; #
prints, but no value
return $self;
}