in reply to Name of subpackage dependent on main package

If you conform to perl's conventions, that is, to have each package in its own file in the proper directory and file names, you may find autopackage to your liking instead of trying to build it yourself. It probably could be extended to include a sub-package name, too, which would give you something like:

use autopackage 'A'; # == package My::A;
I'm not entirely sure that's a great idea, but that doesn't mean I wouldn't do it. PRs accepted :)