No such thing as a small change | |
PerlMonks |
Re^6: Pointers and Referencesby LanX (Saint) |
on Nov 23, 2020 at 22:17 UTC ( [id://11124086]=note: print w/replies, xml ) | Need Help?? |
Your coding style is peculiar, probably C'ish? ;) > our tells you something is "global" where you declare the variable, but it doesn't tell you that where you use it. I have problems to follow. our $var creates a lexically scoped alias to a package variable $PKG::var whith PKG for the current __PACKAGE__ . If you are afraid to loose count "where you use it" just limit the scope, much the same way you do with private vars declared with my. > of a g prefix is an immediate and obvious reminder at the point of use that this is a global variable. Then maybe consider full qualification instead of a g_ prefix. Using $PKG::var is IMHO much clearer, and $::var is a handy shortcut for $main::var
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|