in reply to Multiple packages in one module file

There's another bit in the camel that talks about privacy, saying that nothing prevents you from walking into someone else's living room except politeness. There are very few window bars and shotguns in Perl.

Package names aren't required to have anything to do with file names -- and when you use or require a file, all Perl cares about is translating the name you give into a file path, finding the file, and compiling it. (If it can't find an import() in the associated package, it doesn't really care.)

It's good form to keep package names in sync with their file names. If you need to have separate packages in the same file, they ought to be helper packages. In this case, you're stuck using a. If you run into this often, break out b into its own file.