简体   繁体   中英

How to use a module in Perl

Guys im really confused on how to use a module i just installed in Perl.

I installed a Corelist module in Perl. And i want to display all the modules that came with Perl 5.006. But there is a hint in doing this by using this code which i dont understand:

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

But when i did this

#! usr/bin/perl
use warnings;
use strict;

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

print %modules;

it gives this error: Module::CoreList::version used only once . I also tried putting use Module::CoreList; still no luck

The name of the module is 'Module::CoreList'. You should put the following line into your programme:

use Module::CoreList;

Also note the capital L . Perl is case sensitive.

If you simply want to print the hash, just add 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM