Note, that the above is correct if you didn't precompile all
CGI.pm's methods at server startup. Since if you did, the
procedural interface in the second test will take up to 18k and not 5k
as we saw. That's because the whole of CGI.pm's namespace is
inherited and it already has all its methods compiled, so it doesn't
really matter whether you attempt to import only the symbols that you
need. So if you have:

use CGI qw(-compile :all);

in the server startup script. Having:

use CGI qw(header);

or

use CGI qw(:all);

is essentially the same. You will have all the symbols precompiled at
startup imported even if you ask for only one symbol. It
seems to me like a bug, but probably that's how CGI.pm works.

BTW, you can check the number of opcodes in the code by a simple
command line run. For example, comparing 'my %hash' vs. 'my %hash =
()'.