Q&A

Q1:How do I create many modules, and group them together by name?
A1: Perl groups module names by using :: to separate each grouping from least specific to most specific. For example, under File there are modules called File::Find and File::IO—both are related to files, but perform different functions. To create your own grouping for a module named MyModules::File::FileInfo, you need to create a directory called MyModules, and under that a directory named File, and under that a file named FileInfo.pm where your module code will go.
Q2:I want to put my modules someplace else, separate from the programs. How can I do this?
A2: Perl uses an internal array called @INC to determine where to search for modules. To look for modules in another directory, ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.