Wandering the Stacks
If you look through the directories in @INC
and their subdirectories, you’ll find several different kinds of files
installed. Most have names ending in .pm, but some end in .pl, .ph, .al, or .so. The ones that most interest you are the
first set, because a suffix of .pm
indicates that the file is a proper Perl module. More on those in a
minute.
The few files you see there ending in .pl are those old Perl libraries we mentioned earlier. They are included for compatibility with ancient releases of Perl from the ’80s and early ’90s. Because of this, Perl code that worked back in, say, 1990 should continue to behave properly without any fuss, even if you have a modern version of Perl installed. When writing new code that makes use of the standard Perl library, you should always elect to use the .pm version over any .pl, where possible. That’s because modules don’t pollute your namespace the way many of the old .pl files do. As Perl has evolved, though, the Perl 5 Porters have been removing some of those files, either delegating those tasks to modules or making you go to CPAN to get them.
One note on the use of the .pl extension: it means Perl library, not Perl program. Although .pl is sometimes used to identify Perl programs on web servers that need to distinguish executable programs from static content in the same directory or by some systems to associate a file with a program to open it, we suggest that you use a suffix of .plx instead to indicate an executable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access