in reply to Why to wrap Perl classes inside a Perl script into blocks

Howdy!

You're on the right track. However, lexical variables' scope is delimited by the blocks. package does not make a new scope.

Consider:

{ package Foo; my $foo; } { package Bar; my $foo; # new $foo not to be confused with one above }

Versus:

package Foo; my $foo; package Bar; my $foo; # my declaration masks previous one

yours,
Michael