Using the package keyword to change the package context
#!/usr/bin/perl -w
$main::name = "A";
$Tom::name = "B";
$Jack::name = "C";
print "\$name in package main is $name\n";
package Tom;
print "\$name in package Tom is $name\n";
package Jack;
print "\$name in package Jack is $name\n";
package main;