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

Write a program that explains the symbolic table clearly.

536


What does file test operators do in perl?

509


What is the use of "stderr()"?

573


Comment on data types and variables in perl.

510


What are the advantages of c over Perl?

529






Write a cgi program to show the header part?

526


How to sort arrays in perl?

631


What are scalar data and scalar variables?

639


what is perl language?

516


How to create a package?

529


Which has the highest precedence, List or Terms? Explain?

493


Explain socket programming in perl?

514


How interpreter is used in perl?

490


What are the arguments and what do they mean in perl programming?

528


How does polymorphism work in perl? Give an example.

483