Difference between .pm and .pl files

I know the basic difference between .pm and .pl files. But wat puzzles me is when to go for creating a module and when to create .pl files.Based on wat criteria we sholud decide to make a function whcih implements a common functionality as module or a .pl file ??

While not necessarily true, .pm are typically object-oriented modules. Objects are at a better form for reuse than a snippet of Perl code sequence. You can create individual instances of a specific class so that data specific to the instance can be kept inside (encapsulation) without relying on many value passing.

If you are not interested in object orientation, you may find "require" script files more intuitive.

There is no difference between a .pm and a .pl file. The extensions are purely for convenience. If you "use" a module the "use" function assumes the extension is .pm. If you "require" a module you can name it anything you want.

.pm is used to signify that the file is not the main program but imports some methods or functions into the main program.

When to decide if a file should be a module? That is entirely up to you. If your main program is getting long it might be best to break it up into modules for ease of maintenance or for future additions to the main program. Modules could have common functions, like file I/O stuff in one module, database stuff in another, or they could be broken into major functions of your program. Like if you were writing an inventory program, one module might be used for moving items from one inventory location to another, one module might be used to pull items from inventory, another to add items to inventory.

Thanks a lot cbk and kevin.