How to use a module in Perl

The guys are very confused about how to use the module that I just installed in Perl.

I installed the corelist module in Perl. And I want to display all the modules that come with Perl 5.006. But there is a hint of this using this code, which I do not understand:

my %modules = %{ $Module::CoreList::version{5.006} }; 

But when I did it

 #! usr/bin/perl use warnings; use strict; my %modules = %{$Module::CoreList::version{5.006}}; print %modules; 

he gives this error: Module::CoreList::version used only once . I also tried to put use Module::CoreList; still no luck

+4
source share
2 answers

If you just want to print the hash, just add the Data::Dumper module along with strict and warnings, then

 print Dumper(\%modules); 

Updated: try something like

 use warnings; use strict; use Module::CoreList; use Data::Dumper; my %module = %{ $Module::CoreList::version{5.006} }; print Dumper (\%module); 
+4
source

The module name is "Module :: CoreList". You should put the following line in your program:

 use Module::CoreList; 

Also pay attention to capital L Perl is case sensitive.

+6
source

Source: https://habr.com/ru/post/1481311/


All Articles