in reply to Perl includes to reuse code.

The error doesn't completely go away if you use Data::Dumper; in your The second option, print Data::Dumper(%HASH) line still won't work, because that's just not how perl works.

Instead, if you want to import things, whether implicitly (such as Dumper from the Data::Dumper module) or explicitly (such as gzip from IO::Compress::Gzip), and then make them available to any module that uses your module, you need to explicitly mark those symbols for export, either by providing your own import routine, or using the one from Exporter or other module that provides export functionality.

However, I would only really recommend doing this for truly global functions - ones that really will be used essentially everywhere. I've done this, but I really mean the things I put in there were well and truly global - such as strict, warnings, feature, and a number of other modules that I expected 90%+ of the rest of my modules to require (translation services and trace-logging). Other required modules I would prefer making explicit when and where needed, not to keep the memory usage down, but to help self-documentation: making things explicit. The above ones I put into a "" file because it was our policy to follow strict, enable all warnings, enable perl features explicitly and commonly across the project, to support translation, and to trace nearly everything.