in reply to how to use packages as classes in perl?

A variable declared with my is scoped until the end of it's block or if it is outside of any block, to the end of the file. Thus, this works:

package Foo;
my $bar = 'Hello World';

package main;
print "$bar\n";

A variable declared with our is global and can be accessed by a fully-qualified name. Example: $Foo::bar.

See perldoc perlmod for details on fully-qualified names.