- Perl ›
- Predefined variable ›
- here
Examine the loaded module%INC
Use a predefined variable called %INC to find out which modules are loaded.
%INC
The%INC hash is assigned a combination of module name and module file name. You can see the module name and which file you actually imported. The result output by Data::Dumper is as follows.
$VAR1 = { 'Data/Dumper.pm' =>' C: /Strawberry/perl/lib/Data/Dumper.pm', 'XSLoader.pm' =>' C: /Strawberry/perl/lib/XSLoader.pm', 'feature.pm' =>' C: /Strawberry/perl/lib/feature.pm', 'Carp.pm' =>' C: /Strawberry/perl/lib/Carp.pm', 'warnings.pm' =>' C: /Strawberry/perl/lib/warnings.pm', 'bytes.pm' =>' C: /Strawberry/perl/lib/bytes.pm', 'strict.pm' =>' C: /Strawberry/perl/lib/strict.pm', 'Exporter.pm' =>' C: /Strawberry/perl/lib/Exporter.pm', 'warnings/register.pm' =>' C: /Strawberry/perl/lib/warnings/register.pm', 'constant.pm' =>' C: /Strawberry/perl/lib/constant.pm' };
%INC has nothing to do with @INC, which contains module search path. @INC and%INC are completely different variable. If you want to know only the module name, use keys function to retrieve only the keys.