ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
D.9 PackagesWhen multiple people work on a project, or if you're slighly schizophrenic, you can carve up the variable namespace using packages. A package is just a hidden prefix put in front of most variables (except variables created with the $a = 123; # this is really $main::a $main::a++; # same variable, now 124 package fred; # now the prefix is "fred" $a = 456; # this is $fred::a print $a - $main::a; # prints 456-124 package main; # back to original default print $a + $fred::a; # prints 124+456 So, any name with an explicit package name is used as is, but all other names get packaged into the current default package. Packages are local to the current file or block, and you always start out in package |