Perl module: Difference between revisions

Content deleted Content added
m link
Line 268:
 
==Perl packages and namespaces==
A running Perl program has a built-in [[Namespace (computer science)|namespace]] called "<code>main</code>", which is the default name. For example a subroutine called <code>Sub1</code> can be called as <code>Sub1()</code> or <code>main::Sub1()</code>. With a variable the appropriate [[Sigil (computer programming)|sigil]] is placed in front of the namespace; so a scalar variable called <code>$var1</code> can also be referred to as <code>$main::var1</code>, or even <code>$::var1</code>. Other namespaces can be created at any time.
<source lang="perl">
package Namespace1;