這真的是件不講不明白的事呢。

Perl really shouldn't be spell as PERL

基本上的解釋請參考 perlfaq1 的其中一段,我摘錄如下:

What's the difference between "perl" and "Perl"?

One bit. Oh, you weren't talking ASCII? :-) Larry now uses "Perl" to signify the language proper and "perl" the implementation of it, i.e. the current interpreter. Hence Tom's quip that "Nothing but perl can parse Perl."

Before the first edition of Programming perl, people commonly referred to the language as "perl", and its name appeared that way in the title because it referred to the interpreter. In the book, Randal Schwartz capitalised the language's name to make it stand out better when typeset. This convention was adopted by the community, and the second edition became Programming Perl, using the capitalized version of the name to refer to the language.

You may or may not choose to follow this usage. For example, parallelism means "awk and perl" and "Python and Perl" look good, while "awk and Perl" and "Python and perl" do not. But never write "PERL", because perl is not an acronym, apocryphal folklore and post-facto expansions notwithstanding.

也許是因為對語言本身的喜愛(以及挑惕),Perl 這個圈子的人對於用字特別敏感。簡單的說:

  • 全小寫的 perl 指的是用來編譯、執行程式的直譯器。在多數 Linux/FreeBSD/Mac 作業系統底下,也就是指 /usr/bin/perl 這個執行檔
  • 首字大寫的 Perl 指的是語言本身

在文章裡提到「Python 與 Perl」的時候,你便可以很容易知道這是在比較兩種程式語言。反之若是「awk 與 Perl」的話,則是種不恰當的寫法,因為無法很快地知道,那兩個字指的是執行檔、亦過是程式語本身。

但無論如何,都不應該用拼寫成 PERL (全大寫),為何?因為這個字並非由四個字的首字縮寫而來的。如果你看到 PERL 是 Practical Extraction and Report Language 這四個字縮寫而來的話,那是後來的人湊出來的,是個「逆縮寫字」 ( Backronym ) 。

總之要不就是 perl,要不就是 Perl。這兩種拼寫才是正確的。



blog comments powered by Disqus