in reply to Re^4: Is this a bug in Perl scope?
in thread Is this a bug in Perl scope?

{ package foo; ... }

In addition, prior to 5.14 (and even post-5.14) this idiom terminated the scope of the enclosed package, which was (and is) very useful.

>perl -wMstrict -le "{ package Foo; sub my_pkg { print 'works pre-5.14: ', __PACKAGE__; } } ;; package Bar { sub my_pkg { print 'post-5.14: ', __PACKAGE__; } } Foo::my_pkg(); Bar::my_pkg(); print __PACKAGE__; " works pre-5.14: Foo post-5.14: Bar main

Update: Expanded code example.