in reply to Re: (tye)Re: our/my inconsistency.
in thread our/my inconsistency.
my %hash does nothing to %main::hash, even if you are in package main. That is why "package variables" are also called "globals" and "my variables" are called "lexicals". Lexical variables are not in any symbol table. For example:
This also illustrates a "feature" of our (that might be useful but could also be a source of problems):package one; my $x= "hi"; package two; print "$x\n"; # prints "hi"
- tye (but my friends call me "Tye")package one; our $x= "hi"; use vars qw($y); $y= "lo"; package two; print "$one::x $one::y\n"; # prints "hi lo" print "$x\n"; # prints "hi" print "$y\n"; # prints nothing # and would give an error under C<use strict>
|
|---|