ruggedbuteducated
ruggedbuteducated

Reputation: 1368

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

Upvotes: 4

Views: 390

Answers (2)

Nikhil Jain
Nikhil Jain

Reputation: 8352

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);

Upvotes: 4

choroba
choroba

Reputation: 242123

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.

Upvotes: 6

Related Questions