Historically .pl stood for Perl Library. This was "back in the day" before modules were introduced. Nowadays you see fewer and fewer Perl Libraries in use as people migrate to proper modules. But libraries still are put to good practical use, so the .pl standard continues to exist.

.pm stands for Perl Module. This is an etched in stone convention that exists cross platform. The use statement expects that if you (for example) use Data::Dumper Perl should look for Dumper.pm in the Data directory in one of several possible places where modules typically reside.

Because some operating systems don't have an 'executable' file attribute, and don't look for shebang lines (the #!/path/to/perl line; these are always examine d for switches regardless of OS, but not necessarily for path to Perl and association) it has become somewhat of a convention to use .pl as an extension on Perl scripts that can be associated with the Perl interpreter (perl.exe, on these operating systems). For example, in the Windows registry, if one associates .pl files with perl.exe it will be possible to double-click on a .pl file and have it invoke perl.exe, much like you could click on a .doc file and have it invoke MSWord. It is an unfortunate requirement and convention, as it makes it difficult to differentiate between a Perl script and an old Perl Library.

The .cgi convention is not set in stone. It is dependant on your webserver configuration, and could be something different entirely or not even required. It's not strictly a Perl convention, as scripts written in other scripting languages could also use the .cgi extension to alert the webserver that it's a CGI script. And like I said, there are some webserver configurations where .cgi isn't even needed.

This is discussed in greater detail in the platform specific POD area of Perl's documentation and to some degree in perlrun.


Dave


In reply to Re: Conventional filename suffixes by davido
in thread Conventional filename suffixes by dbae

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.