What is the difference between module and package?

Answer Posted / rameshravi

A package is a division of the global namespace; that means
you can have a global variable $foo and/or a sub named foo
in one package and a different global variable $foo and
different sub named foo in a different package.

A "module" is a file named according to the package it
contains, so module Foo::Bar would be in a file named
Foo/Bar.pm. There's no need for packages to be modules or
for a module to contain only that one package.

The term "module distribution" refers to a collection of one
or more modules that get built/installed together. Sometimes
the "distribution" part is left off and it's just called
"module", but it's really a different idea than a single module.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you match one letter in the current locale?

553


How to create a directory in perl?

522


What can be done for efficient parameter passing in perl?

473


What does next statement do in perl?

575


How are parameters passed to subroutines in perl?

501






Explain what is the scalar data and scalar variables in Perl?

565


How to convert arrays into a string in perl?

512


When would `local $_' in a function ruin your day?

536


Which functions in perl allows you to include a module file. State their differences.

524


How and what are closures implemented in perl?

488


You want to download the contents of a url with perl. How would you do that?

503


How many types of operators are used in the Perl?

578


How to change a directory in perl?

544


Define perl scripting?

573


Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?

521