Perl module: Difference between revisions

Content deleted Content added
Added a section on packages and namespaces
Perl packages and namespaces: Extra comment in extended example
Line 300:
$mainVar = 'b';
{
# NOTE previously created packages and package variables still accessible
package Sp1;
our $sp1bVar = 'bb';
Line 311 ⟶ 312:
}
# main applies again by default, and all package variables are still accessible as long as qualified
print "$mainVar\t$Sp1::sp1aVar$Sp2::sp2bVar\n"; # note main again applies by default
</source>
 
Line 338 ⟶ 339:
 
However, though technically feasible, that would be somewhat dubious programming practice.
 
 
== Further reading ==