Please, tell me, does it have a sense and, if yes, when?Sure, for each package declaration the rest of the lexical scope, or until another package declaration, will be in the given package's namespace. So sub one will live in One::one e.g
This sort of thing is useful when you want to hide packages/classes (e.g under the hood tie implementations) and saves on fully declaring everything (without a package declartion sub one would have to be declared as sub One::one). See. package for more info on it's behaviour.## default namespace is 'main' { package One; sub one { print "I am in ", __PACKAGE__, $/ } } ## namespace back to main as lexical scope has ended One::one(); __output__ I am in One
_________
broquaint
In reply to Re: Using a package into script
by broquaint
in thread Using a package into script
by nite_man
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |