Misplaced Pages

Perl: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editContent deleted Content addedVisualWikitext
Revision as of 19:20, 4 October 2008 editGetly (talk | contribs)20 editsm Factual correction. Whoever is changing this is pushing an opinion, NOT fact.← Previous edit Latest revision as of 04:13, 24 November 2024 edit undoKomonzia (talk | contribs)Extended confirmed users973 edits Community: the comma here was removed in a copyedit on 29 June 2016 but it's meant to be there - as cited, the original JAPH scripts included the comma at the end. 
Line 1: Line 1:
{{Short description|Interpreted programming language first released in 1987}}
{{otheruses}}
{{Other uses|Perl (disambiguation)}} {{distinguish|PEARL (programming language)}}
{{Use mdy dates|date=September 2014}}
{{Infobox programming language {{Infobox programming language
| name = Perl | name = Perl
| logo = Perl language logo.svg
| logo = ]
| paradigm = ] | paradigm = ]
| designer = ]
| year = 1987
| designer = ] | developer = Larry Wall
| latest_release_version = 5.10.0
| latest_release_date = {{release date|mf=yes|2007|12|18}}
| turing-complete = Yes
| typing = Dynamic | typing = Dynamic
| influenced_by = ], ], ], ], ], ], ], ], ] | influenced = ],{{citation needed|date=January 2016}} ],{{citation needed|date=February 2016}} ], ], ], ], ], ], ], ]
| license = ] 1.0<ref name="artistic-1.0"/><ref name="artistic-1.0-git"/> or ] version 1 or any later version<ref name="licensing"/>
| influenced = ], ], ], ], ], ], ]
| website = {{url|https://www.perl.org/|perl.org}}
| operating_system = ]
| wikibooks = Perl Programming
| license = ], ]
| released = {{Start date and age|1987|12|18}}<ref name="perltimeline"/>
| website = http://www.perl.org/
| latest release version = {{Unbulleted list
}}
<!--


|5.40.0<ref>{{cite web |url=https://www.nntp.perl.org/group/perl.perl5.porters/2024/06/msg268252.html |title=Perl v5.40.0 is now available |access-date=2024-06-11 |publisher=www.nntp.perl.org}}</ref> / {{Start date and age|mf=yes|2024|06|09|df=yes}}
NOTES FOR EDITORS


|5.38.2<ref>{{cite web |url=https://www.nntp.perl.org/group/perl.perl5.porters/2023/11/msg267400.html |title=Perl 5.34.3, Perl 5.36.3 and Perl 5.38.2 are now available |access-date=2023-12-05 |publisher=www.nntp.perl.org}}</ref> / {{Start date and age|mf=yes|2023|11|29|df=yes}}
* "Perl" is not an acronym (read the "Name" section below). Do not put that here.
* ] is a correct link. Do not remove the underscore wherever you see it.


}}
-->


| latest preview version=5.41.3<ref>{{cite web|url=https://www.nntp.perl.org/group/perl.perl5.porters/2024/08/msg268756.html |title=Release announcement for perl v5.41.3 |access-date=2024-08-29 |publisher=www.nntp.perl.org}}</ref> / {{Start date and age|2024|08|29|df=yes}}
In computer programming, '''Perl''' is a ], ], ], ]. Perl was originally developed by ], a ] working as a ] for ], in 1987, as a general purpose ] scripting language to make report processing easier.<ref></ref><ref></ref> Since then, it has undergone many changes and revisions and became widely popular among programmers. Larry Wall continues to oversee development of the core language, and its newest version, Perl 6.


| latest preview date=<!-- ;<br/> alpha-02 of {{nowrap|Perl 7}}<ref>{{Cite web|title=Releases · atoomic/perl|url=https://github.com/atoomic/perl/releases|access-date=2021-02-05|website=GitHub|language=en|archive-date=September 7, 2020|archive-url=https://web.archive.org/web/20200907173355/https://github.com/atoomic/perl/releases|url-status=live}}</ref><ref>{{Cite web|title=Announcing Perl 7 - nntp.perl.org|url=https://www.nntp.perl.org/group/perl.perl5.porters/2020/06/msg257565.html|last1=X|first1=Sawyer|date=June 24, 2020|quote=We intend to release 7.0.0 within a year. However, I am setting the goal of releasing it before the end of this year .|access-date=2021-02-05|website=www.nntp.perl.org|archive-date=November 25, 2020|archive-url=https://web.archive.org/web/20201125230437/https://www.nntp.perl.org/group/perl.perl5.porters/2020/06/msg257565.html|url-status=live}}</ref> / {{Start date and age|2020|09|24|mf=yes}} -->
Perl borrows features from other programming languages including ], ]ing (]), ], ] and ].<ref name="perltimeline">{{cite web | url=http://history.perl.org/PerlTimeline.html | title=The Timeline of Perl and its Culture (v3.0_0505) | author=Ashton, Elaine | year=1999}}</ref> The language provides powerful text processing facilities without the arbitrary data length limits of many contemporary Unix tools, <ref name="programmingperl">{{cite book | title=Programming Perl, Third Edition | author=], ] and ] | publisher=O'Reilly | month=July | year=2000 | ISBN=0-596-00027-8}}</ref><!--Ref is from the forward of that book --> making it the ideal language for manipulating ]s. It is also used for ], ], ], ] and ] on the ]. Perl is nicknamed "the ] of programming languages" due to its flexibility and adaptability.<ref> {{cite web|url=http://www.perl.com/pub/a/2000/10/begperl1.html |title=Beginner's Introduction to Perl |accessdate=2008-07-27 |last=Sheppard |first=Doug |date=2000-10-16 |publisher=] }}</ref>
| influenced by=], ], ], ], ], ], ]<ref>{{cite web|title=Programming is Hard, Let's Go Scripting...|last1=Wall|first1=Larry|author1-link=Larry Wall|date=December 12, 2007|url=https://www.perl.com/pub/2007/12/06/soto-11.html/|quote=All language designers have their occasional idiosyncracies. I’m just better at it than most.|access-date=April 14, 2019|archive-date=July 28, 2017|archive-url=https://web.archive.org/web/20170728023959/http://www.perl.com/pub/2007/12/06/soto-11.html|url-status=live}}</ref>
| programming language=]
| operating system=]
| file ext=.plx, .pls, .pl, .pm, .xs, .t, .pod, .cgi, .psgi
}}


'''Perl''' is a ], ], ], ]. Though Perl is not officially an acronym,<ref>{{cite web |url=http://learn.perl.org/faq/perlfaq1.html#Whats-the-difference-between-perl-and-Perl |title=General Questions About Perl |last=Lapworth |first=Leo |publisher=Perl.org |work=Perl FAQ |access-date=February 24, 2012 |archive-date=May 28, 2013 |archive-url=https://web.archive.org/web/20130528001715/http://learn.perl.org/faq/perlfaq1.html#Whats-the-difference-between-perl-and-Perl |url-status=live}}</ref> there are various ]s in use, including "Practical Extraction and Reporting Language".<ref>{{cite web |url=http://linux.die.net/man/1/perl |title=perl(1): Practical Extraction/Report Language - Linux man page |publisher=Linux.die.net |access-date=2013-07-23 |archive-date=June 3, 2013 |archive-url=https://web.archive.org/web/20130603152544/http://linux.die.net/man/1/perl |url-status=live}}</ref>
== History ==
] began work on Perl in 1987, while working as a programmer at ],<ref name="larry-wall-snippet">{{cite web|title=Larry Wall|url=http://www.perl.com/pub/au/Wall_Larry|accessdate=2006-08-20}}</ref> and released version 1.0 to the comp.sources.misc ] on December 18, 1987.<ref>{{cite web|title=Perl, a "replacement" for awk and sed|url=http://groups.google.com/group/comp.sources.unix/browse_thread/thread/363c7a6fa4e2668b/bb3ee125385ae25f|accessdate=2007-12-18}}</ref> The language expanded rapidly over the next few years. Perl 2, released in 1988, featured a better ] engine. Perl 3, released in 1989, added support for ] streams.


Perl was developed by ] in 1987<ref name="long"/> as a general-purpose ] ] to make report processing easier.<ref name="sheppard00">{{cite web |url=http://www.perl.com/pub/2000/10/begperl1.html |title=Beginner's Introduction to Perl |last=Sheppard |first=Doug |date=2000-10-16 |publisher=dev.perl.org |access-date=2011-01-08 |archive-date=June 5, 2011 |archive-url=https://web.archive.org/web/20110605130400/http://www.perl.com/pub/2000/10/begperl1.html |url-status=live}}</ref><ref name="long"/><ref name=":0">{{Cite web |title=Larry Wall, the Guru of Perl |url=https://www.linuxjournal.com/article/3394 |access-date=2023-08-30 |website=Linux Journal}}</ref> Since then, it has undergone many changes and revisions. Perl originally was not capitalized and the name was changed to being capitalized by the time Perl 4 was released.<ref name=":0"/> The latest release is Perl 5, first released in 1994. From 2000 to October 2019 a sixth version of Perl was in development; the sixth version's name was changed to ].<ref>{{cite web |url=https://www.perl.org/about.html |title=About Perl |publisher=perl.org |quote="Perl" is a family of languages, "Perl 6" is part of the family, but it is a separate language that has its own development team. Its existence has no significant impact on the continuing development of "Perl 5". |access-date=2013-04-20 |archive-date=November 6, 2015 |archive-url=https://web.archive.org/web/20151106051931/https://www.perl.org/about.html |url-status=live}}</ref><ref>{{cite web |url=https://github.com/Raku/problem-solving/blob/master/solutions/language/Path-to-Raku.md |title=Path to Raku |publisher=GitHub |quote=This document describes the steps to be taken to effectuate a rename of Perl 6 to Raku |access-date=2021-01-14 |archive-date=November 12, 2020 |archive-url=https://web.archive.org/web/20201112035821/https://github.com/Raku/problem-solving/blob/master/solutions/language/Path-to-Raku.md |url-status=live}}</ref> Both languages continue to be developed independently by different development teams which liberally borrow ideas from each other.
Originally the only documentation for Perl was a single (increasingly lengthy) ]. In 1991, '']'' <!-- 1st edition title used lowercase "perl" --> (known to many Perl programmers as the "Camel Book") was published, and became the ''de facto'' reference for the language. At the same time, the Perl version number was bumped to 4, not to mark a major change in the language, but to identify the version that was documented by the book.


Perl borrows features from other programming languages including ], ], ], and ].<ref name="perltimeline">{{cite web |url=http://history.perl.org/PerlTimeline.html |title=The Timeline of Perl and its Culture (v3.0_0505) |last1=Ashton |first1=Elaine |year=1999 |access-date=March 12, 2004 |archive-date=January 11, 2013 |archive-url=https://web.archive.org/web/20130111100906/http://history.perl.org/PerlTimeline.html |url-status=live}}</ref> It provides text processing facilities without the arbitrary data-length limits of many contemporary ].<ref name="programmingperl2">{{cite book |title=Programming Perl, Third Edition |date=July 2000 |publisher=] |isbn=978-0-596-00027-1 |last1=Wall|first1=Larry|author-link1=Larry Wall|last2= Christiansen|first2=Tom|last3=Orwant|first3=Jon}}</ref> Perl is a highly ] programming language: source code for a given algorithm can be short and highly compressible.<ref>{{Cite web|title=How programs are measured |url=https://benchmarksgame-team.pages.debian.net/benchmarksgame/how-programs-are-measured.html#source-code|access-date=2020-10-05|website=Computer Language Benchmarks Game, Debian.net|archive-date=July 12, 2020|archive-url=https://web.archive.org/web/20200712000728/https://benchmarksgame-team.pages.debian.net/benchmarksgame/how-programs-are-measured.html#source-code|url-status=live}}</ref><ref>{{Cite web|title=RSA in 3 lines of perl - Everything2.com|url=https://everything2.com/title/RSA+in+3+lines+of+perl|access-date=2020-10-05|website=everything2.com|archive-date=October 8, 2020|archive-url=https://web.archive.org/web/20201008120935/https://everything2.com/title/RSA+in+3+lines+of+perl|url-status=live}}</ref>
Perl 4 went through a series of maintenance releases, culminating in Perl 4.036 in 1993. At that point, Wall abandoned Perl 4 to begin work on Perl 5.


Perl gained widespread popularity in the mid-1990s as a ] language, in part due to its powerful ] and ] ] abilities.<ref>{{cite web |url=http://www.catb.org/esr/writings/taoup/html/ch14s04.html#perl |title=Language Evaluations |quote=Perl's strongest point is its extremely powerful built-in facilities for pattern-directed processing of textual, line-oriented data formats; it is unsurpassed at this. |access-date=January 30, 2015 |archive-date=March 10, 2015 |archive-url=https://web.archive.org/web/20150310123855/http://www.catb.org/esr/writings/taoup/html/ch14s04.html#perl |url-status=live}}</ref><ref>{{cite web |url=http://www.cio.com/article/2437271/developer/you-used-perl-to-write-what--.html |title=You Used Perl to Write WHAT?! |date=January 24, 2008 |quote=perl has always been the go-to language for any task that involves pattern-matching input |access-date=February 4, 2015 |archive-date=February 4, 2015 |archive-url=https://web.archive.org/web/20150204175543/http://www.cio.com/article/2437271/developer/you-used-perl-to-write-what--.html |url-status=live}}</ref><ref>{{cite web |url=http://archive.oreilly.com/pub/a/oreilly/perl/news/importance_0498.html |title=The Importance of Perl |quote=Perl's unparalleled ability to process text... |access-date=February 4, 2015 |archive-url=https://web.archive.org/web/20150202010003/http://archive.oreilly.com/pub/a/oreilly/perl/news/importance_0498.html |archive-date=February 2, 2015 |url-status=dead |df=mdy-all}}</ref><ref name="roderick02">{{cite book |title=Advanced Linux Networking |url=https://archive.org/details/linux00libg_999 |url-access=limited |date=June 21, 2002 |publisher=Addison-Wesley Professional |isbn=978-0-201-77423-8 |page= |last1=Smith |first1=Roderick W.}}</ref> In addition to CGI, Perl 5 is used for ], ], finance, ], and other applications, such as for ]s (GUIs). It has been nicknamed "the Swiss Army chainsaw<!-- WARNING: This should read *chainsaw*, not knife. See the reference. --> of scripting languages" because of its flexibility and power.<ref>{{cite web |url=http://www.perl.com/pub/a/2000/10/begperl1.html |title=Beginner's Introduction to Perl |last=Sheppard |first=Doug |date=2000-10-16 |publisher=] |access-date=2008-07-27 |archive-date=June 4, 2008 |archive-url=https://web.archive.org/web/20080604140740/http://www.perl.com/pub/a/2000/10/begperl1.html |url-status=live}}</ref> In 1998, it was also referred to as the "] that holds the ] together", in reference to both its ubiquitous use as a ] and its perceived inelegance.<ref name="leonard98">{{cite news |url=http://www.salon.com/1998/10/13/feature_269/ |title=The joy of Perl |last=Leonard |first=Andrew |work=] |access-date=2012-06-05 |archive-date=July 6, 2012 |archive-url=https://web.archive.org/web/20120706094345/http://www.salon.com/1998/10/13/feature_269/ |url-status=live}}</ref>
Initial design of Perl 5 continued into 1994. ''The perl5-porters'' ] was established in May 1994 to coordinate work on porting Perl 5 to different platforms. It remains the primary forum for development, maintenance, and porting of Perl 5.<ref></ref>


== Name and logos ==
Perl 5 was released on October 17, 1994. It was a nearly complete rewrite of the ], and added many new features to the language, including objects, references, ], and modules. Importantly, modules provided a mechanism for extending the language without modifying the interpreter. This allowed the core interpreter to stabilize, even as it enabled ordinary Perl programmers to add new language features.
{{ multiple image|total_width=400
| image1=Perl-camel-small.png
| caption1=The Camel symbol used by O'Reilly Media
| image2=Perl onion symbol.svg
| caption2=The onion logo used by The Perl Foundation
}}


Perl was originally named "Pearl". Wall wanted to give the language a short name with positive connotations. It is also a Christian reference to the ] from the Gospel of Matthew.<ref name="long"/><ref>{{Cite magazine |date=2016-03-07 |title=Scripting on the Lido Deck |url=https://www.wired.com/2000/10/cruise/ |access-date=2023-02-14 |magazine=Wired|archive-url=https://web.archive.org/web/20160307004219/https://www.wired.com/2000/10/cruise/ |archive-date=March 7, 2016}}</ref> However, Wall discovered the existing ] language before Perl's official release and dropped the "a" from the name.<ref name="richardson1999">{{cite journal|last=Richardson|first=Marjorie|date=1999-05-01|title=Larry Wall, the Guru of Perl|url=http://www.linuxjournal.com/article/3394|url-status=live|journal=]|archive-url=https://web.archive.org/web/20130720013904/http://www.linuxjournal.com/article/3394|archive-date=July 20, 2013|access-date=2011-01-03}}</ref><ref name="long"/>
As of 2008, Perl 5 is still being actively maintained. Important features and some essential new language constructs have been added along the way, including ] support, ], improved support for ] and many other enhancements.


The name is occasionally expanded as a ]: ''Practical Extraction and Report Language''<ref>{{cite book|last1=Schwartz|first1=Randal|url=https://archive.org/details/learningperl00schw_278|title=Learning Perl|last2=foy|first2=brian|last3=Phoenix|first3=Tom|date=June 16, 2011|publisher=O'Reilly Media, Inc.|isbn=978-1449313142|page=|quote=Perl is sometimes called the "Practical Extraction and Report Language", although it has also been called a "Pathologically Eclectic Rubbish Lister", among other expansions. It's actually a backronym, not an acronym, since Larry Wall, Perl's creator, came up with the name first and the expansion later. That's why 'Perl' isn't in all caps. There's no point in arguing that expansion is correct: Larry endorses both.|author-link1=Randal Schwartz|author-link2=brian d foy|url-access=limited}}</ref> and Wall's own ''Pathologically Eclectic Rubbish Lister'', which is in the ] for perl.<ref>{{cite web|last=Wall|first=Larry|author-link=Larry Wall|title=perl - The Perl language interpreter|url=http://perldoc.perl.org/perl.html#BUGS|url-status=live|archive-url=https://web.archive.org/web/20130701050810/http://perldoc.perl.org/perl.html#BUGS|archive-date=July 1, 2013|access-date=2011-01-26|work=Perl 5 version 12.2 documentation}}</ref>
On December 18, 2007, the 20th anniversary of Perl 1.0, Perl 5.10.0 was released. Perl 5.10.0 includes notable new features, which bring it closer to ], among them a new ] (called "given/when"), regular expressions updates, the "smart match operator" ~~, and more.<ref></ref>


''Programming Perl'', published by ], features a picture of a ] on the cover and is commonly called the "Camel Book".<ref name="schwartz01">{{cite book |last1=Schwartz |first1=Randal L |author-link1=Randal L. Schwartz |last2=Phoenix |first2=Tom |last3=Foy |first3=Brian |author-link3=Brian D Foy |title=Learning Perl, Third Edition |isbn=978-0-596-00132-2 |date=2007-12-06 |publisher=O'Reilly Media |url=https://archive.org/details/learningperl00schw}}</ref> This image has become an unofficial symbol of Perl. O'Reilly owns the image as a ] but licenses it for ] use, requiring only an acknowledgement and a link to www.perl.com. Licensing for commercial use is decided on a case-by-case basis.<ref name="camel">{{cite web |url=http://archive.oreilly.com/pub/a/oreilly/perl/usage |archive-url=https://web.archive.org/web/20180425080044/http://archive.oreilly.com/pub/a/oreilly/perl/usage |url-status=dead |archive-date=2018-04-25 |title=The Perl Camel Usage and Trademark Information |access-date=2011-01-09 |publisher=]}}</ref> O'Reilly also provides "Programming Republic of Perl" logos for non-commercial sites and "Powered by Perl" buttons for any site that uses Perl.<ref name="camel"/>
One of the most important events in Perl 5 history took place outside of the language proper, and was a consequence of its module support. On October 26, 1995, the ] (CPAN) was established as a ] for Perl ] and Perl itself. At the time of writing, it carries over 13,500 modules by over 6,500 authors. CPAN is widely regarded as one of the greatest strengths of Perl in practice.


] owns an alternative symbol, an onion, which it licenses to its subsidiaries, ], ], Perl.org, and others.<ref name="onion">{{cite web |url=http://www.perlfoundation.org/perl_trademark |title=Perl Trademark |access-date=2011-01-09 |publisher=] |archive-url=https://web.archive.org/web/20110503211915/http://www.perlfoundation.org/perl_trademark |archive-date=May 3, 2011 |url-status=dead |df=mdy-all}}</ref> The symbol is a ] on ].<ref name="gillmore98">{{cite news |first=Dan |last=Gillmore |title=Republic Of Perl |date=1998-10-25 |url=https://www.chicagotribune.com/1998/10/25/republic-of-perl/ |work=Chicago Tribune |access-date=2011-01-10 |archive-date=April 30, 2011 |archive-url=https://web.archive.org/web/20110430031425/http://articles.chicagotribune.com/1998-10-25/news/9810250094_1_programmers-open-source-movement-programming-community |url-status=live}}</ref>
=== Name ===
Perl was originally named "Pearl", after the ] from the ]. Larry Wall wanted to give the language a short name with positive connotations; he claims that he considered (and rejected) every three- and four-letter word in the dictionary. He also considered naming it after his wife Gloria. Wall discovered the existing ] programming language before Perl's official release and changed the spelling of the name.


== History ==
The name is normally capitalized (''Perl'') when referring to the language and uncapitalized (''perl'') when referring to the interpreter program itself since Unix-like file systems are case-sensitive. Before the release of the first edition of ''Programming Perl'', it was common to refer to the language as ''perl''; ], however, capitalised the language's name in the book to make it stand out better when typeset. The case distinction was subsequently adopted by Perl news group, and to a smaller extent, the Perl community.<ref>{{cite web | url=http://perldoc.perl.org/perlfaq1.html#What's-the-difference-between-%22perl%22-and-%22Perl%22%3f | title=perlfaq1: What's the difference between "perl" and "Perl"?}}</ref> The core of the Perl news group tends to avoid the all-caps spelling "PERL", and some of its members hold the ] that it is incorrect and a ]. It is, in fact, acceptable usage, as it's primary expansion even appears at the beginning of the offical documentation.<ref>{{cite web | last = Schwartz | first = Randal | authorlink = Randal L. Schwartz | title = PERL as shibboleth and the Perl community | url=http://www.perlmonks.org/index.pl?node_id=510594 | accessdate = 2007-06-01 }}</ref>


=== Early versions ===
While the name is occasionally taken as an ] for ''Practical Extraction and Report Language'', the expansion ]<ref>{{cite web | last = Wall | first = Larry | authorlink = Larry Wall | title = Larry Wall | url = http://www.linuxjournal.com/article/3394 | accessdate = 2008-10-02 }}</ref>; several other expansions have been suggested, including Wall's own humorous ''Pathologically Eclectic Rubbish Lister''.<ref>{{cite web | last = Wall | first = Larry | authorlink = Larry Wall | title = BUGS | work = perl(1) ] | url = http://perldoc.perl.org/perl.html#BUGS | accessdate = 2006-10-13 }}</ref> Indeed, Wall claims that the name was intended to inspire many different expansions.


] began work on Perl in 1987, while employed as a programmer at ];<ref name="programmingperl2"/> he released version 1.0 on December 18, 1987.<ref name="perltimeline"/><ref name="long">{{Cite magazine |last=Long |first=Tony |title=Dec. 18, 1987: Perl Simplifies the Labyrinth That Is Programming Language |language=en-US |magazine=Wired |url=https://www.wired.com/2007/12/dec-18-1987-perl-simplifies-the-labyrinth-that-is-programming-language/ |access-date=2023-02-14 |issn=1059-1028}}</ref> Wall based early ''Perl'' on some methods existing languages used for text manipulation.<ref name="long"/>
=== The camel symbol ===
'']'', published by ], features a picture of a ] on the cover, and is commonly referred to as ''The Camel Book''.<ref name="larry-wall-snippet"/> This image of a camel has become a general symbol of Perl.


Perl 2, released in June 1988,<ref name="Kalita ">{{Cite book |last=Kalita |first=Jugal |url=https://books.google.com/books?id=aMuuTttVDcIC |title=On Perl: Perl for Students and Professionals |date=December 2003 |publisher=Universal-Publishers |isbn=978-1-58112-550-4 |language=en}}</ref><ref>{{Cite web |title=Perl Culture |url=https://docstore.mik.ua/orelly/perl/prog3/ch27_01.htm |access-date=2023-03-16 |website=docstore.mik.ua |language=en-US}}</ref> featured a better regular expression engine. Perl 3, released in October 1989,<ref name="Kalita "/> added support for ] streams.<ref>{{Cite web |last=Holloway |first=Ruth |title=Perl turns 30 and its community continues to thrive |url=https://opensource.com/article/17/10/perl-turns-30 |access-date=2023-06-23 |website=Opensource.com |language=en}}</ref>
It is also a ] ], appearing on some ]s and other clothing items.


=== 1990s ===
O'Reilly owns the image as a trademark, but claims to use their legal rights only to protect the ''"integrity and impact of that symbol"''.<ref></ref>
{{Main|Perl 5 version history}}
O'Reilly allows non-commercial use of the symbol, and provides ''Programming Republic of Perl'' logos and ''Powered by Perl'' buttons.<ref></ref>


Originally, the only documentation for Perl was a single lengthy ]. In 1991, ''Programming Perl'', known to many Perl programmers as the "Camel Book" because of its cover, was published and became the ''de facto'' reference for the language.<ref>{{Cite web |title=Programming Perl, 3rd Edition |url=https://www.oreilly.com/library/view/programming-perl-3rd/0596000278/ |access-date=2023-04-11 |website=www.oreilly.com |language=en}}</ref> At the same time, the Perl version number was bumped to 4, not to mark a major change in the language but to identify the version that was well documented by the book.<ref>{{Cite web |title=perlhist - the Perl history records - Perldoc Browser |url=https://perldoc.perl.org/perlhist |access-date=2023-07-28 |website=perldoc.perl.org}}</ref> Perl 4 was released in March 1991.<ref name="Kalita"/>
== Overview ==
Perl is a general-purpose programming language originally developed for text manipulation and now used for a wide range of tasks including ], ], ], ] development, and more.


Perl 4 went through a series of ]s, culminating in Perl 4.036 in 1993, whereupon Wall abandoned Perl 4 to begin work on Perl 5. Initial design of Perl 5 continued into 1994. The ''perl5-porters'' ] was established in May 1994 to coordinate work on porting Perl 5 to different platforms. It remains the primary forum for development, maintenance, and porting of Perl 5.<ref>{{Cite web |url=http://www.nntp.perl.org/group/perl.perl5.porters/ |title=perl.perl5.porters archive |access-date=2011-01-13 |publisher=perl.org |archive-date=May 1, 2011 |archive-url=https://web.archive.org/web/20110501081803/http://www.nntp.perl.org/group/perl.perl5.porters/ |url-status=live}}</ref>
The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal).<ref>perlintro(1) ]</ref> Its major features include support for multiple ] (], ], and ] styles), ] ] (without a cycle-detecting garbage collector), built-in support for text processing, and a large collection of third-party ].


Perl 5.000 was released on October 17, 1994.<ref name="perlhist">{{Cite web |url=http://perldoc.perl.org/perlhist.html |title=perlhist: the Perl history records |access-date=2011-01-21 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=January 13, 2011 |archive-url=https://web.archive.org/web/20110113030100/http://perldoc.perl.org/perlhist.html |url-status=live}}</ref> It was a nearly complete rewrite of the ], and it added many new features to the language, including ], ], ], and ]. Importantly, modules provided a mechanism for extending the language without modifying the interpreter. This allowed the core interpreter to stabilize, even as it enabled ordinary Perl programmers to add new language features. Perl 5 has been in active development since then.
According to Larry Wall, Perl has two slogans. The first is "There's more than one way to do it", commonly known as TMTOWTDI and the second is "Easy things should be easy and hard things should be possible".<ref></ref>


Perl 5.001 was released on March 13, 1995. Perl 5.002 was released on February 29, 1996 with the new prototypes feature. This allowed module authors to make ]s that behaved like Perl ]. Perl 5.003 was released June 25, 1996, as a security release.<ref>{{Cite web |title=Perl: Definition, History, & Facts |url=https://www.britannica.com/technology/Perl |access-date=2022-06-15 |website=Britannica.com |language=en}}</ref>
=== Features ===
The overall structure of Perl derives broadly from C. Perl is procedural in nature, with ]s, ], ]s, ]-delimited ]s, ]s, and ]s.


One of the most important events in Perl 5 history took place outside of the language proper and was a consequence of its module support. On October 26, 1995, the ] (CPAN) was established as a ] for the Perl language and ]s; {{as of|December 2022|lc=y}}, it carries over 211,850 modules in 43,865 distributions, written by more than 14,324 authors, and is mirrored worldwide at more than 245 locations.<ref>{{Cite web |url=https://www.cpan.org/ |title=CPAN |access-date=2022-12-19 |publisher=] |archive-date=October 3, 2019 |archive-url=https://web.archive.org/web/20191003040107/https://www.cpan.org/ |url-status=live}}</ref>
Perl also takes features from shell programming. All variables are marked with leading ], which unambiguously identify the data type (scalar, array, hash, etc.) of the variable in context. Importantly, sigils allow variables to be interpolated directly into strings. Perl has many built-in functions which provide tools often used in shell programming (though many of these tools are implemented by programs external to the shell) like sorting, and calling on system facilities.


Perl 5.004 was released on May 15, 1997, and included, among other things, the UNIVERSAL package, giving Perl a base object from which all ] were automatically derived and the ability to require versions of modules. Another significant development was the inclusion of the ] module,<ref name="5004delta">{{Cite web |url=http://perldoc.perl.org/perl5004delta.html |title=perl5004delta – what's new for perl5.004 |access-date=2011-01-08 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=February 27, 2011 |archive-url=https://web.archive.org/web/20110227200616/http://perldoc.perl.org/perl5004delta.html |url-status=live}}</ref> which contributed to Perl's popularity as a ].<ref name="patwardhan02">{{Cite book |last1=Patwardhan |first1=Nathan |last2=Siever |first2=Ellen |last3=Spainhour |first3=Stephen |title=Perl in a Nutshell, Second Edition |publisher=] |year=2002 |isbn=978-0-596-00241-1 |url=https://archive.org/details/perlinnutshell00patw}}</ref>
Perl takes ] from Lisp, ]s (hashes) from AWK, and ]s from sed. These simplify and facilitate many parsing, text handling, and data management tasks.


Perl 5.004 added support for ], ], ], and ].<ref name="5004delta"/>
In Perl 5, features were added that support complex ]s, ]s (i.e., ] as values), and an object-oriented programming model. These include ], packages, class-based method dispatch, and ], along with ]s (for example, the <tt>strict</tt> pragma). A major additional feature introduced with Perl 5 was the ability to package code as reusable modules. Larry Wall later stated that "The whole intent of Perl 5's module system was to encourage the growth of Perl culture rather than the Perl core."<ref>Usenet post, May 10th 1997, with ID 199705101952.MAA00756@wall.org.</ref>


Perl 5.005 was released on July 22, 1998. This release included several enhancements to the ] engine, new hooks into the backend through the <code>B::*</code> modules, the <code>qr//</code> regex quote operator, a large selection of other new core modules, and added support for several more operating systems, including ].<ref name="5005delta">{{Cite web |url=http://perldoc.perl.org/perl5005delta.html |title=perl5005delta - what's new for perl5.005 |access-date=2011-01-21 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=February 3, 2011 |archive-url=https://web.archive.org/web/20110203100249/http://perldoc.perl.org/perl5005delta.html |url-status=live}}</ref>
All versions of Perl do automatic data typing and memory management. The interpreter knows the type and storage requirements of every data object in the program; it allocates and frees storage for them as necessary using ] (so it cannot deallocate circular data structures without manual intervention). Legal type conversions—for example, conversions from number to string—are done automatically at run time; illegal type conversions are fatal errors.


=== Design === ===2000–2020===
{| class="wikitable floatright"
The design of Perl can be understood as a response to three broad trends in the computer industry: falling hardware costs, rising labor costs, and improvements in compiler technology. Many earlier computer languages, such as ] and C, were designed to make efficient use of expensive computer hardware. In contrast, Perl is designed to make efficient use of expensive computer programmers.
|-
! Major version<ref name="perlhist"/>
! Latest update<ref>{{cite web |url=https://www.cpan.org/src/README.html |title=Perl Source |publisher=cpan.org |access-date=2023-11-26}}</ref>
|-
| {{Version|o|5.4}}
| 1999-04-29
|-
| {{Version|o|5.5}}
| 2004-02-23
|-
| {{Version|o|5.6}}
| 2003-11-15
|-
| {{Version|o|5.8}}
| 2008-12-14
|-
| {{Version|o|5.10}}
| 2009-08-22
|-
| {{Version|o|5.12}}
| 2012-11-10
|-
| {{Version|o|5.14}}
| 2013-03-10
|-
| {{Version|o|5.16}}
| 2013-03-11
|-
| {{Version|o|5.18}}
| 2014-10-01
|-
| {{Version|o|5.20}}
| 2015-09-12
|-
| {{Version|o|5.22}}
| 2017-07-15
|-
| {{Version|o|5.24}}
| 2018-04-14
|-
| {{Version|o|5.26}}
| 2018-11-29
|-
| {{Version|o|5.28}}
| 2020-06-01
|-
| {{Version|o|5.30}}
| 2020-06-01
|-
| {{Version|o|5.32}}
| 2021-01-23
|-
| {{Version|o|5.34}}
| 2023-11-29
|-
| {{Version|o|5.36}}
| 2023-11-29
|-
| {{Version|co|5.38}}
| 2023-11-29
|-
| {{Version|c|5.40}}
| 2024-06-09
|-
| colspan="99" |<small>{{Version|lv|show=011111|}}</small>
|}
<!--
| {{Version|cp|5.39}}
| 2023-04-20
|-
| {{Version|p|7.0}}
| 2024?
|-
-->


Perl 5.6 was released on March 22, 2000. Major changes included ] support, ] string representation, support for files over 2 GiB, and the "our" keyword.<ref name="56delta">{{cite web |url=http://perldoc.perl.org/perl56delta.html |title=perl56delta - what's new for perl v5.6.0 |access-date=2011-01-21 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=February 2, 2011 |archive-url=https://web.archive.org/web/20110202135358/http://perldoc.perl.org/perl56delta.html |url-status=live}}</ref><ref name="561delta">{{cite web |url=http://perldoc.perl.org/perl561delta.html |title=perl56delta - what's new for perl v5.6.x |access-date=2011-01-21 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=November 18, 2010 |archive-url=https://web.archive.org/web/20101118101544/http://perldoc.perl.org/perl561delta.html |url-status=live}}</ref> When developing Perl 5.6, the decision was made to switch the ] scheme to one more similar to other open source projects; after 5.005_63, the next version became 5.5.640, with plans for development versions to have odd numbers and stable versions to have even numbers.<ref>{{Cite web |title=Perl {{!}} Definition, History, & Facts {{!}} Britannica |url=https://www.britannica.com/technology/Perl |access-date=2022-06-15 |website=www.britannica.com |language=en}}</ref>
Perl has many features that ease the programmer's task at the expense of greater CPU and memory requirements. These include automatic memory management; ]; strings, lists, and hashes; regular expressions; introspection and an <tt>eval()</tt> function.


In 2000, Wall put forth a call for suggestions for a new version of Perl from the community. The process resulted in 361 RFC (]) documents that were to be used in guiding development of Perl 6. In 2001,<ref>{{cite web |url=http://dev.perl.org/perl6/doc/design/apo/A01.html |title=Apocalypse 1: The Ugly, the Bad, and the Good |access-date=2011-01-08 |last=Wall |first=Larry |archive-date=November 23, 2010 |archive-url=https://web.archive.org/web/20101123182201/http://dev.perl.org/perl6/doc/design/apo/A01.html |url-status=dead}}</ref> work began on the "Apocalypses" for Perl 6, a series of documents meant to summarize the change requests and present the design of the next generation of Perl. They were presented as a digest of the RFCs, rather than a formal document. At this time, Perl 6 existed only as a description of a language.{{Citation needed|date=December 2020}}
Wall was trained as a linguist, and the design of Perl is very much informed by linguistic principles. Examples include ] (common constructions should be short), good end-weighting (the important information should come first), and a large collection of language primitives. Perl favors language constructs that are concise and natural for humans to read and write, even where they complicate the Perl interpreter.


Perl 5.8 was first released on July 18, 2002, and further 5.X versions have been released approximately yearly since then. Perl 5.8 improved Unicode support, added a new I/O implementation, added a new thread implementation, improved numeric accuracy, and added several new modules.<ref name="perl58delta">{{cite web |url=http://perldoc.perl.org/perl58delta.html |title=perl58delta - what is new for perl v5.8.0 |access-date=2011-01-21 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=November 21, 2010 |archive-url=https://web.archive.org/web/20101121023149/http://perldoc.perl.org/perl58delta.html |url-status=live}}</ref> As of 2013, this version was still the most popular Perl version and was used by ] ] 5, ] 10, ] 10, ] 11.31, and ] 5.
Perl syntax reflects the idea that "things that are different should look different". For example, scalars, arrays, and hashes have different leading ]. Array indices and hash keys use different kinds of braces. Strings and regular expressions have different standard delimiters. This approach can be contrasted with languages like ], where the same ] construct and basic syntax is used for many different purposes.


In 2004, work began on the "Synopses" – documents that originally summarized the Apocalypses, but which became the specification for the Perl 6 language. In February 2005, ] began work on ], a Perl 6 interpreter written in ].<ref>{{cite web |url=http://www.perl.com/pub/a/2005/03/03/pugs_interview.html |title=A Plan for Pugs |date=2005-03-03 |publisher=] |access-date=2011-01-27 |archive-date=September 8, 2012 |archive-url=https://archive.today/20120908200150/http://www.perl.com/pub/2005/03/03/pugs_interview.html |url-status=live}}</ref> This was the first concerted effort toward making Perl 6 a reality. This effort stalled in 2006.<ref>{{cite web |url=http://www.perlmonks.org/?node_id=835936 |title=Re: How to Implement Perl 6 in Ten Years |access-date=2011-01-03 |last=Tang |first=Audrey |date=2010-04-21 |publisher=] |archive-date=May 11, 2011 |archive-url=https://web.archive.org/web/20110511190417/http://www.perlmonks.org/?node_id=835936 |url-status=live}}</ref>
Perl does not enforce any particular programming paradigm (procedural, object-oriented, functional, etc.) or even require the programmer to choose among them.


The Perl On New Internal Engine (PONIE) project existed from 2003 until 2006. It was to be a bridge between Perl 5 and 6, and an effort to rewrite the Perl 5 interpreter to run on the Perl 6 ]. The goal was to ensure the future of the millions of lines of Perl 5 code at thousands of companies around the world.<ref>{{citation|last1=Broadwell|first1=Geoff|date=August 8, 2005<!-- 8:52PM -->|title=OSCON 4.4: Inside Ponie, the Bridge from Perl 5 to Perl 6|url=http://www.oreillynet.com/onlamp/blog/2005/08/oscon_44_inside_ponie_the_brid.html|archive-url=https://web.archive.org/web/20120314013450/http://www.oreillynet.com/onlamp/blog/2005/08/oscon_44_inside_ponie_the_brid.html|publisher=O'Reilly ONLamp Blog|access-date=June 27, 2016|archive-date=March 14, 2012|url-status=live}}</ref> The PONIE project ended in 2006 and is no longer being actively developed. Some of the improvements made to the Perl 5 interpreter as part of PONIE were folded into that project.<ref>{{citation|last1=Vincent|first1=Jesse|author1-link=Jesse Vincent|title=Ponie has been put out to pasture|date=August 23, 2006<!-- 10:40 PM -->|url=http://news.perlfoundation.org/2006/08/ponie_has_been_put_out_to_past.html|df=mdy-all|archive-url=https://web.archive.org/web/20090627091007/http://news.perlfoundation.org/2006/08/ponie_has_been_put_out_to_past.html|publisher=The Perl Foundation|access-date=January 15, 2019|archive-date=June 27, 2009|url-status=dead}}</ref>
There is a broad practical bent to both the Perl language and the community and culture that surround it. The preface to ''Programming Perl'' begins, "Perl is a language for getting your job done." One consequence of this is that Perl is not a tidy language. It includes many features, tolerates exceptions to its rules, and employs heuristics to resolve syntactical ambiguities. Because of the forgiving nature of the compiler, bugs can sometimes be hard to find. Discussing the variant behaviour of built-in functions in list and scalar contexts, the perlfunc(1) manual page says "In general, they do what you want, unless you want consistency."


On December 18, 2007, the 20th anniversary of Perl 1.0, Perl 5.10.0 was released. Perl 5.10.0 included notable new features, which brought it closer to Perl 6. These included a ] (called "given"/"when"), regular expressions updates, and the ''smart match operator'' (~~).<ref name="5100delta">{{cite web |url=http://perldoc.perl.org/perl5100delta.html |title=perl5100delta - what is new for perl 5.10.0 |access-date=2011-01-08 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=December 21, 2010 |archive-url=https://web.archive.org/web/20101221024004/http://perldoc.perl.org/perl5100delta.html |url-status=live}}</ref><ref name="perlsyn-smart">{{cite web |url=http://perldoc.perl.org/perlsyn.html#Smart-matching-in-detail |title=perlsyn - Perl syntax |access-date=2011-01-21 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=August 26, 2013 |archive-url=https://web.archive.org/web/20130826100652/http://perldoc.perl.org/perlsyn.html#Smart-matching-in-detail |url-status=live}}</ref>
Perl has several mottos that convey aspects of its design and use. One is ''"]."'' (TIMTOWTDI, usually pronounced 'Tim Toady'). Others are ''"Perl: the Swiss Army Chainsaw of Programming Languages"'' and ''"No unnecessary limits"''. A stated design goal of Perl is to make easy tasks easy and difficult tasks possible. Perl has also been called ''"The Duct Tape of the Internet"''.<ref>{{cite web | url = http://www.oreillynet.com/pub/a/oreilly/perl/news/importance_0498.html | title = The Importance of Perl | year = 1998 | month = April | publisher = O'Reilly & Associates, Inc. | quote = As Hassan Schroeder, Sun's first webmaster, remarked: “Perl is the duct tape of the Internet.” }}</ref>
Around this same time, development began in earnest on another implementation of Perl 6 known as ] Perl, developed in tandem with the ]. As of November 2009, Rakudo Perl has had regular monthly releases and now is the most complete implementation of Perl 6.


A major change in the development process of Perl 5 occurred with Perl 5.11; the development community has switched to a monthly release cycle of development releases, with a yearly schedule of stable releases. By that plan, bugfix point releases will follow the stable releases every three months.{{Citation needed|date=December 2020}}
There is no written specification or standard for the Perl language, and no plans to create one for the current version of Perl. There has only been one implementation of the interpreter. That interpreter, together with its functional tests, stands as a ''de facto'' specification of the language.


On April 12, 2010, Perl 5.12.0 was released. Notable core enhancements include new <code>package NAME VERSION</code> syntax, the ] (intended to mark placeholder code that is not yet implemented), implicit {{Not a typo|strictures}}, full ] compliance, regex conversion overloading, ] support, and ] 5.2.<ref name="5120delta">{{cite web |url=http://perldoc.perl.org/perl5120delta.html |title=perl5120delta - what is new for perl v5.12.0 |access-date=2011-01-08 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=January 4, 2011 |archive-url=https://web.archive.org/web/20110104093548/http://perldoc.perl.org/perl5120delta.html |url-status=live}}</ref>
=== Applications ===
Perl has many and varied applications, compounded by the availability of many standard and third-party modules.


On May 14, 2011, Perl 5.14 was released with ] support built-in.<ref>{{cite web|url=https://metacpan.org/pod/distribution/perl/pod/perl5140delta.pod|title=perl5140delta - what is new for perl v5.14.0 - metacpan.org|website=metacpan.org|access-date=July 22, 2017|archive-date=July 25, 2018|archive-url=https://web.archive.org/web/20180725004523/https://metacpan.org/pod/distribution/perl/pod/perl5140delta.pod|url-status=live}}</ref>
Perl has been used since the early days of the Web to write ] scripts. It is known as one of "the three Ps" (along with ] and ]), the most popular dynamic languages for writing Web applications. It is also an integral component of the popular ] ] for web development. Large projects written in Perl include ], ], ] and ]. Many high-traffic websites, such as ], ], ], ] and ]<ref>{{cite web | title = IMDb Helpdesk: What software/hardware are you using to run the site? | url = http://www.imdb.com/help/search?domain=helpdesk_faq&index=1&file=techinfo | accessdate = 2007-09-01 }}</ref> use Perl extensively.


On May 20, 2012, Perl 5.16 was released. Notable new features include the ability to specify a given version of Perl that one wishes to emulate, allowing users to upgrade their version of Perl, but still run old scripts that would normally be incompatible.<ref name="5160delta_version">{{cite web |url=https://perldoc.perl.org/perl5160delta |title=perl5160delta - what is new for perl v5.16.0 |access-date=2012-05-21 |website=perldoc.perl.org}}</ref>{{Failed verification|date=June 2022}} Perl 5.16 also updates the core to support ] 6.1.<ref name="5160delta_version"/>
Perl is often used as a ], tying together systems and interfaces that were not specifically designed to interoperate, and for "data munging", i.e., converting or processing large amounts of data for tasks like creating reports. In fact, these strengths are intimately linked. The combination makes perl a popular all-purpose tool for ]s, particularly as short programs can be entered and run on a single command line.


On May 18, 2013, Perl 5.18 was released. Notable new features include the new dtrace hooks, lexical subs, more CORE:: subs, overhaul of the hash for security reasons, support for Unicode 6.2.<ref name="5180delta_version">{{cite web |url=https://metacpan.org/pod/release/RJBS/perl-5.18.1/pod/perl5180delta.pod |title=perl5180delta - what is new for perl v5.18.0 - Perl programming language |access-date=2013-10-27 |work=Perl 5 version 18.0 documentation |publisher=metacpan.org |archive-date=October 29, 2013 |archive-url=https://web.archive.org/web/20131029224638/https://metacpan.org/pod/release/RJBS/perl-5.18.1/pod/perl5180delta.pod |url-status=live}}</ref>
With a degree of care, Perl code can be made portable across Windows and Unix. Portable Perl code is often used by suppliers of software (both COTS and bespoke) to simplify packaging and maintenance of software build and deployment scripts.


On May 27, 2014, Perl 5.20 was released. Notable new features include subroutine signatures, hash slices/new slice syntax, postfix dereferencing (experimental), Unicode 6.3, and a {{Not a typo|rand()}} function using a consistent random number generator.<ref name="5200delta_version">{{cite web |url=https://metacpan.org/source/RJBS/perl-5.20.0/pod/perldelta.pod |title=perl5200delta - what is new for perl v5.20.0 - Perl programming language |access-date=2014-05-27 |work=Perl 5 version 20.0 documentation |publisher=metacpan.org |archive-date=May 27, 2014 |archive-url=https://archive.today/20140527190905/https://metacpan.org/source/RJBS/perl-5.20.0/pod/perldelta.pod |url-status=live}}</ref>
Graphical user interfaces (GUI's) may be developed using Perl. In particular, Perl/Tk is commonly used to enable user interaction with Perl scripts. Such interaction may be synchronous or asynchronous using callbacks to update the GUI. For more information about the technologies involved see ],] and ].


Some observers credit the release of Perl 5.10 with the start of the Modern Perl movement.<ref> {{Webarchive|url=https://web.archive.org/web/20121027105918/http://www.modernperlbooks.com/mt/2009/07/milestones-in-the-perl-renaissance.html |date=October 27, 2012}}. Modernperlbooks.com. Retrieved on 2013-07-17.</ref> In particular, this phrase describes a style of development that embraces the use of the CPAN, takes advantage of recent developments in the language, and is rigorous about creating high quality code.<ref> {{Webarchive|url=https://web.archive.org/web/20120928232457/http://modernperlbooks.com/books/modern_perl/ |date=September 28, 2012}}. Modernperlbooks.com. Retrieved on 2013-07-17.</ref> While the book ''Modern Perl''<ref> {{Webarchive|url=https://web.archive.org/web/20111222045417/http://onyxneon.com/books/modern_perl/ |date=December 22, 2011}}. Onyxneon.com. Retrieved on 2013-07-17.</ref> may be the most visible standard-bearer of this idea, other groups such as the Enlightened Perl Organization<ref>{{cite web|url=http://www.enlightenedperl.org/|title=Enlightened Perl|website=Enlightened Perl|access-date=September 28, 2012|archive-date=February 5, 2014|archive-url=https://web.archive.org/web/20140205015536/http://www.enlightenedperl.org/|url-status=dead}}</ref> have taken up the cause.
Perl is also widely used in finance and ], where it is valued for rapid application development and deployment, and the ability to handle large data sets.


In late 2012 and 2013, several projects for alternative implementations for Perl 5 started: Perl5 in ] by the Rakudo Perl team,<ref>{{cite web |url=http://www.yapcna.org/yn2013/talk/4725 |title=YAPC::NA 2013 – June 3–5, Austin, Texas |publisher=Yapcna.org |date=2013-06-04 |access-date=2014-04-11 |archive-url=https://web.archive.org/web/20130622201417/http://www.yapcna.org/yn2013/talk/4725 |archive-date=June 22, 2013 |url-status=dead}}</ref> ''{{Not a typo|moe}}'' by Stevan Little and friends,<ref>{{cite web |last=Little |first=Stevan |url=http://blogs.perl.org/users/stevan_little/2013/02/what-is-moe-a-clarification.html |title=What is Moe (a clarification) &#124; Stevan Little |publisher=Blogs.perl.org |date=2013-02-08 |access-date=2014-04-11 |archive-date=December 19, 2013 |archive-url=https://web.archive.org/web/20131219185710/http://blogs.perl.org/users/stevan_little/2013/02/what-is-moe-a-clarification.html |url-status=live}}</ref> ''{{Not a typo|p2}}''<ref>{{cite web |url=http://perl11.org/p2/ |title=p2 on potion |publisher=Perl11.org |date=2004-02-07 |access-date=2014-04-11 |archive-date=September 24, 2013 |archive-url=https://web.archive.org/web/20130924023845/http://perl11.org/p2/ |url-status=live}}</ref> by the Perl11 team under Reini Urban, ''{{Not a typo|gperl}}'' by {{Not a typo|goccy}},<ref>{{cite web |url=https://github.com/goccy/gperl/ |title=goccy/gperl 路 GitHub |publisher=GitHub.com |access-date=2014-04-11 |archive-date=February 23, 2015 |archive-url=https://web.archive.org/web/20150223170215/https://github.com/goccy/gperl |url-status=live}}</ref> and ''{{Not a typo|rperl}},'' a Kickstarter project led by Will Braswell and affiliated with the Perl11 project.<ref>{{cite web |url=http://rperl.org/faq.html |title=rperl |publisher=RPerl.org |access-date=2014-08-11 |archive-date=October 18, 2014 |archive-url=https://web.archive.org/web/20141018002115/http://rperl.org/faq.html |url-status=live}}</ref>
=== Implementation ===
Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C. The source distribution is, ], 12&nbsp;] when packaged in a ] and ]. The interpreter is 150,000 lines of C code and compiles to a 1&nbsp;MB executable on typical machine architectures. Alternatively, the interpreter can be compiled to a link library and embedded in other programs. There are nearly 500 modules in the distribution, comprising 200,000 lines of Perl and an additional 350,000 lines of C code. (Much of the C code in the modules consists of character encoding tables.)


=== Perl 6 and Raku ===
The interpreter has an object-oriented architecture. All of the elements of the Perl language—scalars, arrays, hashes, coderefs, file handles—are represented in the interpreter by C structs. Operations on these structs are defined by a large collection of macros, typedefs and functions; these constitute the Perl C API. The Perl API can be bewildering to the uninitiated, but its entry points follow a consistent naming scheme, which provides guidance to those who use it.
{{Main|Raku (programming language)}}
]


At the 2000 ], Jon Orwant made a case for a major new language initiative.<ref>{{cite web |url=http://www.nntp.perl.org/group/perl.perl6.meta/2000/10/msg424.html |title=Transcription of Larry's talk |access-date=2011-01-25 |last=Torkington |first=Nathan |publisher=nntp.perl.org |archive-date=May 1, 2011 |archive-url=https://web.archive.org/web/20110501081806/http://www.nntp.perl.org/group/perl.perl6.meta/2000/10/msg424.html |url-status=live}}</ref> This led to a decision to begin work on a redesign of the language, to be called Perl 6. Proposals for new language features were solicited from the Perl community at large, which submitted more than 300 ].<ref>{{Cite web|title=Perl6 - The future of Perl|url=https://www.java-samples.com/showtutorial.php?tutorialid=1443|access-date=2021-05-18|website=www.java-samples.com}}</ref>
The execution of a Perl program divides broadly into two phases: compile-time and run-time.<ref>A description of the Perl 5 interpreter can be found in ''Programming Perl'', 3rd Ed., </ref> At compile time, the interpreter parses the program text into a syntax tree. At run time, it executes the program by walking the tree. The text is parsed only once, and the syntax tree is subject to optimization before it is executed, so the execution phase is relatively efficient. Compile-time optimizations on the syntax tree include ] and context propagation, but ] is also performed. However, compile-time and run-time phases may nest: <code>BEGIN</code> code blocks execute at compile-time, while the <code>]</code> function initiates compilation during runtime. Both operations are an implicit part of a number of others—most notably, the <code>use</code> clause that loads libraries, known in Perl as modules, implies a <code>BEGIN</code> block.


Wall spent the next few years digesting the RFCs and synthesizing them into a coherent framework for Perl 6. He presented his design for Perl 6 in a series of documents called "apocalypses" – numbered to correspond to chapters in ''Programming Perl''. {{as of|2011|January}}, the developing specification of Perl 6 was encapsulated in design documents called Synopses – numbered to correspond to Apocalypses.<ref name="syn6">{{cite web |url=http://perlcabal.org/syn/ |title=Official Perl 6 Documentation |access-date=2011-01-25 |publisher=The Perl 6 Project |archive-url=https://web.archive.org/web/20090831103918/http://perlcabal.org/syn/ |archive-date=August 31, 2009 |url-status=dead}}</ref>
Perl has a context-sensitive ] which can be affected by code executed during an intermittent run-time phase.<ref>{{cite web | last = Schwartz | first = Randal | authorlink = Randal L. Schwartz | title = On Parsing Perl | url =http://www.perlmonks.org/index.pl?node_id=44722 | accessdate = 2007-01-03 }}</ref> Therefore Perl cannot be parsed by a straight ]/] lexer/parser combination. Instead, the interpreter implements its own lexer, which coordinates with a modified ] parser to resolve ambiguities in the language. It is said that "only perl can parse Perl", meaning that only the ] (''perl'') can parse the Perl language (''Perl''). The truth of this is attested to by the persistent imperfections of other programs that undertake to parse Perl, such as source code analyzers and auto-indenters, which have to contend not only with the many ways to express unambiguous syntactic constructs, but also the fact that Perl cannot be parsed in the general case without executing it. Though successful in creating a Perl parser for document-related purposes, the PPI project determined that parsing Perl code as a document (retaining its integrity) and as executable code simultaneously was, in fact, not possible. Specifically the author claimed that, "parsing Perl suffers from the '].'"<ref>{{cite web | url=http://search.cpan.org/~adamk/PPI-1.201/lib/PPI.pm | title=PPI—Parse, Analyze and Manipulate Perl (without perl) | author=Kennedy, Adam | year=2006 | publisher=]}}</ref>


Thesis work by ], overseen by Wall, considered the possible use of the ] as a runtime for Perl.<ref>{{cite thesis |last=Kuhn |first=Bradley M. |author-link=Bradley M. Kuhn |title=Considerations on Porting Perl to the Java Virtual Machine |type=MS thesis |publisher=University of Cincinnati |date=January 2001 |url=http://www.ebb.org/bkuhn/writings/technical/thesis/ |access-date=2008-06-28 |archive-date=March 21, 2008 |archive-url=https://web.archive.org/web/20080321164747/http://ebb.org/bkuhn/writings/technical/thesis/ |url-status=live}}</ref> Kuhn's thesis showed this approach to be problematic. In 2001, it was decided that Perl 6 would run on a cross-language ] called ].
Perl is distributed with some 120,000 functional tests. These run as part of the normal build process, and extensively exercise the interpreter and its core modules. Perl developers rely on the functional tests to ensure that changes to the interpreter do not introduce bugs; conversely, Perl users who see the interpreter pass its functional tests on their system can have a high degree of confidence that it is working properly.


In 2005, ] created the ] project, an implementation of Perl 6 in ]. This acted as, and continues to act as, a test platform for the Perl 6 language (separate from the development of the actual implementation), allowing the language designers to explore. The Pugs project spawned an active Perl/Haskell cross-language community centered around the ] #raku IRC channel. Many ] influences were absorbed by the Perl 6 design team.<ref>{{Cite book|author1=chromatic|author1-link=chromatic (programmer)|url=https://books.google.com/books?id=JUjmsgEACAAJ|title=Modern Perl|date=2015|publisher=Pragmatic Bookshelf|isbn=978-1-68050-088-2|language=en}}</ref>
Maintenance of the Perl interpreter has become increasingly difficult over the years. The code base has been in continuous development since 1994. The code has been optimized for performance at the expense of simplicity, clarity, and strong internal interfaces. New features have been added, yet virtually complete backward compatibility with earlier versions is maintained. The size and complexity of the interpreter is a barrier to developers who wish to work on it.


In 2012, Perl 6 development was centered primarily on two compilers:<ref>{{cite web |url=http://perl6.org/compilers/features |title=Feature comparison of Perl 6 compilers |access-date=March 28, 2012 |archive-url=https://web.archive.org/web/20170811073233/https://perl6.org/compilers/features |archive-date=August 11, 2017 |url-status=dead}}</ref>
=== Availability ===
# ], an implementation running on the Parrot virtual machine and the Java virtual machine.<ref>{{cite web |last=Worthington |first=Jonathan |title=Rakudo JVM News: More tests, plus Thread and Promise prototypes |url=http://6guts.wordpress.com/2013/07/15/rakudo-jvm-news-more-tests-plus-thread-and-promise-prototypes/ |work=6guts |date=July 15, 2013 |access-date=July 24, 2013 |archive-date=October 5, 2013 |archive-url=https://web.archive.org/web/20131005055559/http://6guts.wordpress.com/2013/07/15/rakudo-jvm-news-more-tests-plus-thread-and-promise-prototypes/ |url-status=live}}</ref>
<!--Note to editors:
# ], which targets the ].
Perl is available on so many platforms that it doesn't make sense to keep a laundry list in this article.
Do not list a specific platform unless there are notable issues about running Perl on it.


In 2013, ] ("Metamodel On A Runtime"), a C language-based ] designed primarily for Rakudo was announced.<ref>{{cite web |last=Worthington |first=Jonathan |title=MoarVM: A virtual machine for NQP and Rakudo |url=http://6guts.wordpress.com/2013/05/31/moarvm-a-virtual-machine-for-nqp-and-rakudo/ |work=6guts |date=May 31, 2013 |access-date=July 24, 2013 |archive-date=July 9, 2013 |archive-url=https://web.archive.org/web/20130709185252/http://6guts.wordpress.com/2013/05/31/moarvm-a-virtual-machine-for-nqp-and-rakudo/ |url-status=live}}</ref>
-->Perl is ], and is licensed under both the ] and the ]. Distributions are available for most ]s. It is particularly prevalent on ] and ] systems, but it has been ported to most modern (and many obsolete) platforms. With only six reported exceptions, Perl can be compiled from ] on all Unix-like, ]-compliant or otherwise Unix-compatible platforms.<ref name="cpanports">{{cite web | url=http://www.cpan.org/ports/ | title=Perl Ports (Binary Distributions) | publisher=CPAN.org | author=Hietaniemi, Jarkko | year=1998}}</ref> However, this is rarely necessary, as Perl is included in the default installation of many popular operating systems.


In October 2019, Perl 6 was renamed to Raku.<ref>{{cite web |url=https://lwn.net/Articles/802329/ |title=rename-lwn |access-date=November 10, 2019 |archive-url=https://web.archive.org/web/20191017155422/https://lwn.net/Articles/802329/ |archive-date=October 17, 2019 |url-status=dead}}</ref>
Because of unusual changes required for the ] environment, a special port called MacPerl was shipped independently.<ref name="macperl">{{cite web | url=http://www.macperl.com/ | title=The MacPerl Pages | year=1997 | publisher=Prime Time Freeware}}</ref>


{{As of|2017}} only the Rakudo implementation and MoarVM are under active development, and other virtual machines, such as the Java Virtual Machine and ], are supported.<ref>{{cite web |url=https://github.com/rakudo/rakudo/ |title=rakudo/rakudo - GitHub |publisher=GitHub.com |access-date=2013-09-21 |archive-date=July 29, 2017 |archive-url=https://web.archive.org/web/20170729084734/https://github.com/rakudo/rakudo/ |url-status=live}}</ref>
The CPAN carries a complete list of supported platforms with links to the distributions available on each.<ref></ref>


==== Windows ==== === Perl 7 ===


In June 2020, Perl 7 was announced as the successor to Perl 5.<ref name="perl7announced">{{cite web |url=https://news.perlfoundation.org/post/perl_7_announced_sawyerx_conference |title=Perl 7 announced at Perl Conference in the Cloud |publisher=perlfoundation.org |date=2020-06-24 |access-date=2020-06-24 |archive-date=June 26, 2020 |archive-url=https://web.archive.org/web/20200626213418/https://news.perlfoundation.org/post/perl_7_announced_sawyerx_conference |url-status=live}}</ref> Perl 7 was to initially be based on Perl 5.32 with a release expected in first half of 2021, and release candidates sooner.<ref name="perl7">{{cite web |url=https://www.perl.com/article/announcing-perl-7/ |title=Announcing Perl 7 |publisher=perl.com |date=2020-06-24 |access-date=2020-06-24 |archive-date=June 24, 2020 |archive-url=https://web.archive.org/web/20200624160531/https://www.perl.com/article/announcing-perl-7/ |url-status=live}}</ref>
Users of ] typically install one of the native binary distributions of Perl for Win32<ref>{{cite web | url=http://win32.perl.org/index.php?title=Win32_Distributions#Perl_Distributions | title=Win32 Distributions | publisher=Win32 Perl Wiki}}</ref>, most commonly ]. Compiling Perl from ] under Windows is possible, but most installations lack the requisite C compiler and build tools. This also makes it hard to install modules from the CPAN, particularly those that are partially written in C.


This plan was revised in May 2021, without any release timeframe or version of Perl 5 for use as a baseline specified.<ref>{{Cite web|title=Steering Council meeting #019 2021-05-06|url=https://www.nntp.perl.org/group/perl.perl5.porters/2021/05/msg260050.html|last1=Clark|first1=Nicholas|date=2021-05-09|quote=The plan remains that there will be a Perl 7 bump, but not immediately after 5.34.0 is released.{{nbsp}}... We don't think that we can deliver on in 12 months.|access-date=2021-05-17|website=www.nntp.perl.org|archive-date=2021-05-18|archive-url=https://web.archive.org/web/20210518015233/https://www.nntp.perl.org/group/perl.perl5.porters/2021/05/msg260050.html|url-status=live}}</ref> When Perl 7 would be released, Perl 5 would have gone into long term maintenance. Supported Perl 5 versions however would continue to get important security and bug fixes.<ref>{{cite book |url=https://leanpub.com/preparing_for_perl7 |title=Preparing for Perl 7d |publisher=leanpub.com |date=2020-06-24 |access-date=2020-06-24 |archive-date=June 25, 2020 |archive-url=https://web.archive.org/web/20200625004047/https://leanpub.com/preparing_for_perl7 |url-status=live}}</ref>
Users of the ActivePerl binary distribution are therefore dependent on the repackaged modules provided in ]’s module repository, which are precompiled and can be installed with ]. Limited resources to maintain this repository have been cause for various long-standing problems.<ref>{{cite web | url=http://www.mail-archive.com/perl-qa@perl.org/msg05407.html | title=Activestate and Scalar-List-Utils | author=Golden, David | year=2006}}</ref><ref>{{cite web | url=http://use.perl.org/~Alias/journal/35219 | title=ActivePerl PPM repository design flaw goes critical | author=Kennedy, Adam | year=2007}}</ref>


Perl 7 was announced on 24 June 2020 at "The Perl Conference in the Cloud" as the successor to Perl 5.<ref name="perl7"/><ref name="perl7announced"/> Based on Perl 5.32, Perl 7 was planned to be ] with modern Perl 5 code; Perl 5 code, without ] (pragma) header needs adding <code>use compat::perl5;</code> to stay compatible, but modern code can drop some of the boilerplate.
To address this and other problems of Perl on the Windows platform, was launched by Adam Kennedy on behalf of ] in June 2006. This is a community website for "all things Windows and Perl." A major aim of this project is to provide production-quality alternative Perl distributions that include an embedded C compiler and build tools, so as to enable Windows users to install modules directly from the CPAN. The production distribution in the family is known as , with research and experimental work done in a related distribution.


The plan to go to Perl 7 brought up more discussion, however, and the Perl Steering Committee canceled it to avoid issues with backward compatibility for scripts that were not written to the pragmas and modules that would become the default in Perl 7. Perl 7 will only come out when the developers add enough features to warrant a major release upgrade.<ref>{{cite web |last1=Perl Steering Council |title=What happened to Perl 7? |url=https://blogs.perl.org/users/psc/2022/05/what-happened-to-perl-7.html |website=blogs.perl.org |access-date=7 July 2022}}</ref>
Another popular way of running Perl under Windows is provided by the ] emulation layer. Cygwin provides a Unix-like environment on Windows and both perl and cpan are conveniently available as standard pre-compiled packages in the Cygwin setup program. Since Cygwin also includes the ], compiling Perl from source is also possible.


== Language structure == == Design ==
{{Main|Perl language structure}}
In Perl, the minimal ] program may be written as follows:
<source lang="perl">
print "Hello, world!\n"
</source>
This ] the ] ''Hello, world!'' and a ], symbolically expressed by an <code>n</code> character whose interpretation is altered by the preceding ] (a backslash).


=== Philosophy ===
The canonical form of the program is slightly more verbose:


According to Wall, Perl has two slogans. The first is "There's more than one way to do it," commonly known as TMTOWTDI, (pronounced ''Tim Toady''). As proponents of this motto argue, this philosophy makes it easy to write concise statements.<ref>{{cite web |last1=Richardson |first1=Marjorie |title=Larry Wall, the Guru of Perl {{!}} Linux Journal |url=https://www.linuxjournal.com/article/3394 |website=www.linuxjournal.com |publisher=Linux Journal |access-date=16 January 2023}}</ref><ref>{{Cite journal |last=Schwartz |first=Alan |date=December 1998 |title=Tutorial: Perl, a psychologically efficient reformatting language |journal=Behavior Research Methods, Instruments, & Computers |language=en |volume=30 |issue=4 |pages=605–609 |doi=10.3758/BF03209477 |s2cid=61028367 |issn=0743-3808|doi-access=free}}</ref><ref>{{Cite journal |last=Gilbert |first=James G. R. |date=March 2002 |title=How to become a programming tadpole |url=http://www.nature.com/articles/nbt0302-221 |journal=Nature Biotechnology |language=en |volume=20 |issue=3 |pages=221 |doi=10.1038/nbt0302-221 |s2cid=38728402 |issn=1087-0156}}</ref>
<source lang="perl">
#!/usr/bin/perl
print "Hello, world!\n";
</source>


The second slogan is "Easy things should be easy and hard things should be possible".<ref name="programmingperl2"/>
The hash mark character introduces a ] in Perl, which runs up to the end of the line of code and is ignored by the compiler. The comment used here is of a special kind: it’s called the ] line. This tells Unix-like operating systems where to find the Perl interpreter, making it possible to invoke the program without explicitly mentioning <code>perl</code>. (Note that on ] systems, Perl programs are typically invoked by associating the <code>.pl</code> ] with the Perl interpreter. In order to deal with such circumstances, <code>perl</code> detects the shebang line and parses it for switches,<ref name="perlrun">{{cite web | url=http://perldoc.perl.org/perlrun.html#DESCRIPTION | title=perlrun manpage}}</ref> so it is not strictly true that the shebang line is ignored by the compiler.)


The design of Perl can be understood as a response to three broad trends in the computer industry: falling hardware costs, rising labor costs, and improvements in ] technology. Many earlier computer languages, such as ] and C, aimed to make efficient use of expensive computer hardware. In contrast, Perl was designed so that computer programmers could write programs more quickly and easily.<ref>{{Cite web |date=February 13, 2014 |title=The Fall Of Perl, The Web's Most Promising Language |url=https://www.fastcompany.com/3026446/the-fall-of-perl-the-webs-most-promising-language |website=FastCompany}}</ref>
The second line in the canonical form includes a semicolon, which is used to separate statements in Perl. With only a single statement in a block or file, a separator is unnecessary, so it can be omitted from the minimal form of the program—or more generally from the final statement in any block or file. The canonical form includes it because it is common to terminate every statement even when it is unnecessary to do so, as this makes editing easier: code can be added to or moved away from the end of a block or file without having to adjust semicolons.


Perl has many features that ease the task of the programmer at the expense of greater ] and memory requirements. These include automatic memory management; ]; strings, lists, and hashes; regular expressions; ]; and an <code>eval()</code> function. Perl follows the theory of "no built-in limits",<ref name="schwartz01"/> an idea similar to the ] rule.
Version 5.10 of Perl introduces a <code>say</code> function that implicitly appends a newline character to its output, making the minimal "Hello world" program even shorter:


Wall was trained as a linguist, and the design of Perl is very much informed by ] principles. Examples include ] (common constructions should be short), good end-weighting (the important information should come first), and a large collection of ]s. Perl favors language constructs that are concise and natural for humans to write, even where they complicate the Perl interpreter.<ref>{{Cite web|last=Wall|first=Larry|title=perl - The Perl 5 language interpreter - Perldoc Browser|url=https://perldoc.perl.org/perl|access-date=2021-06-24|website=perldoc.perl.org}}</ref>
<source lang="perl">
say 'Hello, world!'
</source>


Perl's ] reflects the idea that "things that are different should look different."<ref name="wall97">{{cite journal |url=http://www.linuxjournal.com/article/2070 |title=Wherefore Art, Thou? |access-date=2011-03-13 |last=Wall |first=Larry |date=1997-03-01 |journal=] |archive-date=December 9, 2010 |archive-url=https://web.archive.org/web/20101209021107/http://www.linuxjournal.com/article/2070 |url-status=live}}</ref> For example, scalars, arrays, and hashes have different leading sigils. Array indices and hash keys use different kinds of braces. Strings and regular expressions have different standard delimiters.
=== Data types ===
Perl has a number of fundamental ]s, the most commonly used and discussed being: ], ]s, ], ]s and ]:
* A ] is a single value; it may be a number, a ] or a ]
* An ] is an ordered collection of scalars
* A hash, or ], is a map from strings to scalars; the strings are called ''keys'' and the scalars are called ''values''.
* A ] is a map to a file, device, or pipe which is open for reading, writing, or both.
* A subroutine is a piece of code that may be passed arguments, be executed, and return data


There is a broad practical bent to both the Perl language and the community and culture that surround it. The preface to ''Programming Perl'' begins: "Perl is a language for getting your job done."<ref name="programmingperl2"/> One consequence of this is that Perl is not a tidy language. It includes many features, tolerates exceptions to its rules, and employs ] to resolve syntactical ambiguities. Because of the forgiving nature of the compiler, bugs can sometimes be hard to find. Perl's function documentation remarks on the variant behavior of built-in functions in list and scalar contexts by saying, "In general, they do what you want, unless you want consistency."<ref name="perlfunc">{{cite web |url=http://perldoc.perl.org/perlfunc.html |title=perlfunc - Perl builtin functions |access-date=2011-01-10 |work=Perl 5 version 12.2 documentation |publisher=perldoc.perl.org |archive-date=January 6, 2011 |archive-url=https://web.archive.org/web/20110106003034/http://perldoc.perl.org/perlfunc.html |url-status=live}}</ref>
Most variables are marked by a leading ], which identifies the data type being accessed (not the type of the variable itself), except filehandles, which don't have a sigil. The same name may be used for variables of different data types, without conflict.


=== Features ===
<source lang="perl">
$foo # a scalar
@foo # an array
%foo # a hash
FOO # a file handle
&FOO # a constant (but the & is optional)
&foo # a subroutine (but the & is optional)
</source>


The overall structure of Perl derives broadly from C. Perl is ] in nature, with ]s, ], ]s, ]-delimited ]s, ]s, and ]s.<ref>{{Cite book|last=Nagpal|first=D.P.|title=Web Design Technology|publisher=S. Chand|year=2010|isbn=978-8121927635|location=India|pages=700|language=English}}</ref>
]s and constants need not be uppercase, but it is a common convention because there is no sigil to denote them. Both are global in scope, but file handles are interchangeable with references to file handles, which can be stored in scalars, which in turn permit lexical scoping. Doing so is encouraged in ]'s ''Perl Best Practices''. As a convenience, the <code>open</code> function in Perl 5.6 and newer will autovivify undefined scalars to file handle references.


Perl also takes features from shell programming. All variables are marked with leading ], which allow variables to be ] directly into ]. However, unlike the shell, Perl uses sigils on all accesses to variables, and unlike most other programming languages that use sigils, the sigil doesn't denote the type of the variable but the type of the expression. So for example, while an array is denoted by the sigil "@" (for example <code>@arrayname</code>), an individual member of the array is denoted by the scalar sigil "$" (for example <code>$arrayname</code>). Perl also has many built-in functions that provide tools often used in shell programming (although many of these tools are implemented by programs external to the shell) such as ], and calling ] facilities.{{Citation needed|date=December 2020}}
Numbers are written in the bare form; strings are enclosed by quotes of various kinds.


Perl takes ] ("associative arrays") from ] and ]s from ]. These simplify many parsing, text-handling, and data-management tasks. Shared with ] is the implicit ] of the last value in a block, and all statements are also expressions which can be used in larger expressions themselves.{{Citation needed|date=December 2020}}
<source lang="perl">
$name = "joe";
$color = 'red';


Perl 5 added features that support complex ]s, ]s (that is, ] as values), and an object-oriented programming model. These include ], packages, class-based ], and ], along with ]s (for example, the <code>strict</code> ]). A major additional feature introduced with Perl 5 was the ability to package code as reusable modules. Wall later stated that "The whole intent of Perl 5's module system was to encourage the growth of Perl culture rather than the Perl core."<ref>{{cite newsgroup |title=title unknown |date=1997-05-10 |message-id=199705101952.MAA00756@wall.org}}{{Dead link|date=November 2014}}</ref>
$number1 = 42;
$number2 = '42';


All versions of Perl do automatic ] and automatic ]. The interpreter knows the type and ] requirements of every data object in the program; it allocates and frees storage for them as necessary using ] (so it cannot deallocate ] without manual intervention). Legal ]s – for example, conversions from number to string – are done automatically at ]; illegal type conversions are fatal errors.{{Citation needed|date=December 2020}}
# This evaluates to true
if ($number1 == $number2) { print "Numbers and strings of numbers are the same!"; }


=== Syntax ===
$answer = "The answer is $number1"; # Variable interpolation: The answer is 42
$price = 'This device costs $42'; # No interpolation in single quotes


Perl has been referred to as "]" and a "write-only language" by its critics. ] in the first edition of the book '']'',<ref>{{cite journal |title=Developer Update|volume=2 |journal=Dr. Dobb's Developer Update |publisher=Miller-Freeman |year=1995}}</ref><!-- page 15 --> in the first chapter states: "Yes, sometimes Perl looks like line noise to the uninitiated, but to the seasoned Perl programmer, it looks like ]med line noise with a mission in life."<ref name="LP">{{cite book |title=Learning Perl |last=Schwartz |first=Randal L. |author-link=Randal L. Schwartz |publisher=O'Reilly & Associates |year=1993 |title-link=Learning Perl |bibcode=1993lepe.book.....S}}</ref> He also stated that the accusation that Perl is a write-only language could be avoided by coding with "proper care".<ref name="LP"/> The Perl overview document ''{{Not a typo|perlintro}}'' states that the names of built-in "magic" scalar ] "look like punctuation or line noise".<ref>{{cite web |url=http://perldoc.perl.org/perlintro.html |title=perlintro |work=Perl 5 version 18.0 documentation |publisher=Perl 5 Porters and perldoc.perl.org |access-date=2013-06-30 |archive-url=https://web.archive.org/web/20110109121845/http://perldoc.perl.org/perlintro.html |archive-date=January 9, 2011 |url-status=dead}}</ref> However, the English module provides both long and short English alternatives. ''{{Not a typo|perlstyle}}'' document states that line noise in regular expressions could be mitigated using the <code>/x</code> modifier to add whitespace.<ref>{{cite web |url=http://perldoc.perl.org/perlstyle.html |title=perlstyle |work=Perl 5 version 18.0 documentation |publisher=Perl 5 Porters and perldoc.perl.org |access-date=2013-06-30 |archive-url=https://web.archive.org/web/20130626010707/http://perldoc.perl.org/perlstyle.html |archive-date=June 26, 2013 |url-status=dead}}</ref>
$album = "It's David Bowie's \"Heroes\""; # literal quotes inside a string;
$album = 'It\'s David Bowie\'s "Heroes"'; # same as above with single quotes;
$album = q(It's David Bowie's "Heroes"); # the quote-like operators q() and qq() allow
# almost any delimiter instead of quotes, to
# avoid excessive backslashing


According to the ''Perl 6 FAQ'', Perl 6 was designed to mitigate "the usual suspects" that elicit the "line noise" claim from Perl 5 critics, including the removal of "the majority of the punctuation variables" and the sanitization of the regex syntax.<ref name="P6FAQ">{{cite web |url=http://www.perl6.org/archive/faq.html |title=Perl 6 FAQ |publisher=Perl 6 Project |access-date=2013-06-30 |archive-date=July 1, 2013 |archive-url=https://web.archive.org/web/20130701183900/http://www.perl6.org/archive/faq.html |url-status=dead}}</ref> The ''Perl 6 FAQ'' also states that what is sometimes referred to as Perl's line noise is "the actual syntax of the language" just as ]s and ] are a part of the ].<ref name="P6FAQ"/> In a December 2012 blog posting, despite claiming that "Rakudo Perl 6 has failed and will continue to fail unless it gets some adult supervision", ] stated that the design of Perl 6 has a "well-defined grammar", an "improved type system, a unified object system with an intelligent metamodel, metaoperators, and a clearer system of context that provides for such niceties as pervasive laziness".<ref name="chromatic-blog">{{cite web |url=http://www.modernperlbooks.com/mt/2012/12/the-implementation-of-perl-5-versus-perl-6.html |title=The Implementation of Perl 5 versus Perl 6 |author1=chromatic |author1-link=chromatic (programmer) |date=2012-12-31 |access-date=2013-06-30 |archive-date=July 29, 2013 |archive-url=https://web.archive.org/web/20130729214209/http://www.modernperlbooks.com/mt/2012/12/the-implementation-of-perl-5-versus-perl-6.html |url-status=live}}</ref> He also stated that "Perl 6 has a coherence and a consistency that Perl 5 lacks."<ref name="chromatic-blog"/>
$multilined_string =<<EOF;
This is my multilined string
note that I am terminating it with the "EOF" word.
EOF
</source>


In Perl, one could write the ] as:
Perl will convert strings into numbers and vice versa depending on the context in which they are used. In the following example the strings $n and $m are treated as numbers when they are the arguments to the addition operator. This code prints the number '5', discarding non numeric information for the operation, although the variable values remain the same. (The string concatenation operator is the period, not the <code>+</code> symbol.)


<source lang="perl"> <syntaxhighlight lang="perl">
print "Hello, World!\n";
$n = '3 apples';
</syntaxhighlight>
$m = '2 oranges';
print $n + $m;
</source>


Here is a more complex Perl program, that counts down seconds from a given starting value:
Perl also has a boolean context that it uses in evaluating conditional statements. The following values all evaluate as false in Perl:


<source lang="perl"> <syntaxhighlight lang="perl">
#!/usr/bin/perl
$false = 0; # the number zero
use strict;
$false = 0.0; # the number zero as a float
use warnings;
$false = 0b0; # the number zero in binary
$false = 0x0; # the number zero in hexadecimal
$false = '0'; # the string zero
$false = ""; # the empty string
$false = undef; # the return value from undef
</source>


my ( $remaining, $total );
All other values are evaluated to true. This includes the odd self-describing literal string of "0 but true", which in fact is 0 as a number, but true when used as a boolean. (Any non-numeric string would also have this property, but this particular string is ignored by Perl with respect to numeric warnings.) A less explicit but more conceptually portable version of this string is '0E0' or '0e0', which does not rely on characters being evaluated as 0, as '0E0' is literally "zero times ten to the zeroth power."


$remaining=$total=shift(@ARGV);
Evaluated boolean expressions also return scalar values. Although the documentation does not promise which ''particular'' true or false is returned (and thus cannot be relied on), many boolean operators return 1 for true and the empty-string for false (which evaluates to zero in a numeric context). The ''defined()'' function tells if the variable has any value set. In the above examples ''defined($false)'' is true for every value except ''undef''.


STDOUT->autoflush(1);
If a specifically 1 or 0 result (as in C) is needed, an explicit conversion is thought by some authors to be required:


while ( $remaining ) {
<source lang="perl">
printf ( "Remaining %s/%s \r", $remaining--, $total );
my $real_result = $boolean_result ? 1 : 0;
sleep 1;
</source>

However, if it's known that the value is either 1 or ''undef'', an implicit conversion can be used instead:

<source lang="perl">
my $real_result = $boolean_result + 0;
</source>

A list is written by listing its elements, separated by commas, and enclosed by parentheses where required by operator precedence.

<source lang="perl">
@scores = (32, 45, 16, 5);
</source>

It can be written many other ways as well, some straightforward and some less so:

<source lang="perl">
# An explicit and straightforward way
@scores = ('32', '45', '16', '5');

# Equivalent to the above, but the qw() quote-like operator saves typing of
# quotes and commas and reduces visual clutter; almost any delimiter can be
# used instead of parentheses
@scores = qw(32 45 16 5);

# The split function returns a list of strings, which are extracted
# from the expression using a regex template.
# This may be useful for reading from a file of comma-separated values (CSV)
@scores = split /,/, '32,45,16,5';

# It's also possible to use a postfix for operator and aliasing of
# the $_ magic variable to the next value of the list during each
# iteration; this is pointless here, but similar idioms are widely used
# in some circumstances.
push @scores, $_ foreach 32, 45, 16, 5;
</source>

A hash may be initialized from a list of key/value pairs:

<source lang="perl">
%favorite = (
joe => 'red',
sam => 'blue'
);
</source>

The <code>=></code> operator is equivalent to a comma, except that it assumes quotes around the preceding token if it is a bare identifier: <code>(joe => 'red')</code> is the same as <code>('joe' => 'red')</code>. It can therefore be used to elide quote marks, improving readability.

Individual elements of a list are accessed by providing a numerical index, in square brackets. Individual values in a hash are accessed by providing the corresponding key, in curly braces. The <code>$</code> sigil identifies the accessed element as a scalar.

<source lang="perl">
$scores # an element of @scores
$favorite{joe} # a value in %favorite
</source>

Thus, a hash can also be specified by setting its keys individually:

<source lang="perl">
$favorite{joe} = 'red';
$favorite{sam} = 'blue';
</source>

Multiple elements may be accessed by using the <code>@</code> sigil instead (identifying the result as a list).

<source lang="perl">
@scores # three elements of @scores
@favorite{'joe', 'sam'} # two values in %favorite
@favorite{qw(joe sam)} # same as above
</source>

The number of elements in an array can be obtained by evaluating the array in scalar context or with the help of the <code>$#</code> sigil. The latter gives the index of the last element in the array, not the number of elements. ''Note: the ] in Misplaced Pages's software mistakenly considers some of the following code to be part of the comments.''

<source lang="perl">
$count = @friends; # Assigning to a scalar forces scalar context

$#friends; # The index of the last element in @friends
$#friends+1; # Usually the number of elements in @friends is one more
# than $#friends because the first element is at index 0,
# not 1, unless the programmer reset this to a different
# value, which most Perl manuals discourage.
</source>

There are a few functions that operate on entire hashes.

<source lang="perl">
@names = keys %addressbook;
@addresses = values %addressbook;

# Every call to each returns the next key/value pair.
# All values will be eventually returned, but their order
# cannot be predicted.
while (($name, $address) = each %addressbook) {
print "$name lives at $address\n";
} }


print "\n";
# Similar to the above, but sorted alphabetically
</syntaxhighlight>
foreach my $next_name (sort keys %addressbook) {
print "$next_name lives at $addressbook{$next_name}\n";
}
</source>


The Perl interpreter can also be used for one-off scripts on the command line. The following example (as invoked from an sh-compatible shell, such as ]) translates the string "Bob" in all files ending with .txt in the current directory to "Robert":
=== Control structures ===
{{main|Perl control structures}}


<syntaxhighlight lang="console">
Perl has several kinds of control structures.
$ perl -i.bak -lp -e 's/Bob/Robert/g' *.txt
</syntaxhighlight>


=== Implementation ===
It has block-oriented control structures, similar to those in the C, ], and ] programming languages. Conditions are surrounded by parentheses, and controlled blocks are surrounded by braces:


No written ] or standard for the Perl language exists for Perl versions through Perl 5, and there are no plans to create one for the current version of Perl. There has been only one implementation of the interpreter, and the language has evolved along with it. That interpreter, together with its functional tests, stands as a ''de facto'' specification of the language. Perl 6, however, started with a specification,<ref>{{cite web |url=http://www.perl6.org/specification |title=Perl 6 Specification |access-date=2011-01-27 |publisher=The Perl 6 Project |archive-date=December 2, 2009 |archive-url=https://web.archive.org/web/20091202073507/http://www.perl6.org/specification/ |url-status=live}}</ref> and several projects<ref>{{cite web |url=http://www.perl6.org/compilers/ |title=Perl 6 Compilers |access-date=2011-01-27 |publisher=The Perl 6 Project |archive-date=December 2, 2009 |archive-url=https://web.archive.org/web/20091202073302/http://www.perl6.org/compilers/ |url-status=live}}</ref> aim to implement some or all of the specification.{{Citation needed|date=December 2020}}
''label'' while ( ''cond'' ) { ... }
''label'' while ( ''cond'' ) { ... } continue { ... }
''label'' for ( ''init-expr'' ; ''cond-expr'' ; ''incr-expr'' ) { ... }
''label'' foreach ''var'' ( ''list'' ) { ... }
''label'' foreach ''var'' ( ''list'' ) { ... } continue { ... }
if ( ''cond'' ) { ... }
if ( ''cond'' ) { ... } else { ... }
if ( ''cond'' ) { ... } elsif ( ''cond'' ) { ... } else { ... }


Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C. {{As of|2010}}, the interpreter is 150,000 lines of C code and compiles to a 1&nbsp;MB executable on typical machine architectures. Alternatively, the interpreter can be compiled to a link library and embedded in other programs. There are nearly 500 modules in the distribution, comprising 200,000 lines of Perl and an additional 350,000 lines of C code (much of the C code in the modules consists of ] tables).{{Citation needed|date=December 2020}}
Where only a single statement is being controlled, statement modifiers provide a more concise syntax:


The interpreter has an object-oriented architecture. All of the elements of the Perl language—scalars, arrays, hashes, coderefs, ]s—are represented in the interpreter by ]. Operations on these structs are defined by a large collection of ], ]s, and functions; these constitute the Perl C ]. The Perl API can be bewildering to the uninitiated, but its entry points follow a consistent ], which provides guidance to those who use it.{{Citation needed|date=December 2020}}
''statement'' if ''cond'' ;
''statement'' unless ''cond'' ;
''statement'' while ''cond'' ;
''statement'' until ''cond'' ;
''statement'' foreach ''list'' ;


The life of a Perl interpreter divides broadly into a compile phase and a run phase.<ref>A description of the Perl 5 interpreter can be found in ''Programming Perl'', 3rd Ed., chapter 18. See particularly page 467, which carefully distinguishes run phase and compile phase from ] and ]. Perl "time" and "phase" are often confused.</ref> In Perl, the ''phases'' are the major stages in the interpreter's life-cycle. Each interpreter goes through each phase only once, and the phases follow in a fixed sequence.{{Citation needed|date=December 2020}}
] are commonly used to affect control flow at the expression level:


Most of what happens in Perl's compile phase is compilation, and most of what happens in Perl's run phase is execution, but there are significant exceptions. Perl makes important use of its capability to execute Perl code during the compile phase. Perl will also delay compilation into the run phase. The terms that indicate the kind of processing that is actually occurring at any moment are ''compile time'' and ''run time''. Perl is in compile time at most points during the compile phase, but compile time may also be entered during the run phase. The compile time for code in a string argument passed to the <code>]</code> built-in occurs during the run phase. Perl is often in run time during the compile phase and spends most of the run phase in run time. Code in <code>BEGIN</code> blocks executes at run time but in the compile phase.<!-- NOTE TO EDITORS: There is something missing in the preceding sentence -- for one thing, a comma before the conjunction. The sentence might reasonably read 'Code in BEGIN blocks executes NOT at run time, but in the compile phase,' but is that what the author intended? -->
''expr'' and ''expr''
''expr'' && ''expr''
''expr'' or ''expr''
''expr'' <nowiki>||</nowiki> ''expr''


At compile time, the interpreter parses Perl code into a ]. At run time, it executes the program by ]. Text is parsed only once, and the syntax tree is subject to optimization before it is executed, so that execution is relatively efficient. Compile-time optimizations on the syntax tree include ] and context propagation, but ] is also performed.<ref>{{Cite web|title=perlguts - Introduction to the Perl API - Perldoc Browser|url=https://perldoc.perl.org/perlguts#Compile-pass-3:-peephole-optimization|access-date=2022-01-24|website=perldoc.perl.org}}</ref>
(The "and" and "or" operators are similar to && and <nowiki>||</nowiki> but have lower ], which makes it easier to use them to control entire statements.)


Perl has a ] ] because parsing can be affected by run-time code executed during the compile phase.<ref>{{cite web |last=Schwartz |first=Randal |author-link=Randal L. Schwartz |title=On Parsing Perl |url=http://www.perlmonks.org/index.pl?node_id=44722 |access-date=2007-01-03 |archive-date=September 27, 2007 |archive-url=https://web.archive.org/web/20070927000827/http://www.perlmonks.org/index.pl?node_id=44722 |url-status=live}}</ref> Therefore, Perl cannot be parsed by a straight ]/] ]/] combination. Instead, the interpreter implements its own lexer, which coordinates with a modified ] parser to resolve ambiguities in the language.{{Citation needed|date=December 2020}}
The flow control keywords <code>next</code> (corresponding to C's <code>continue</code>), <code>last</code> (corresponding to C's <code>break</code>), <code>return</code>, and <code>redo</code> are expressions, so they can be used with short-circuit operators.


It is often said that "Only perl can parse Perl",<ref>{{cite web |url=ftp://ftp.ora.com/pub/labs/tpj/tpj2.pdf |title=The Perl Journal #19/9.26 |access-date=2011-02-04 |publisher=] }}{{Dead link|date=August 2024 |bot=InternetArchiveBot |fix-attempted=yes }}</ref> meaning that only the Perl interpreter (''<code>perl</code>'') can parse the Perl language (''Perl''), but even this is not, in general, true. Because the Perl interpreter can simulate a Turing machine during its compile phase, it would need to decide the ] in order to complete parsing in every case. It is a longstanding result that the halting problem is undecidable, and therefore not even Perl can always parse Perl. Perl makes the unusual choice of giving the user access to its full programming power in its own compile phase. The cost in terms of theoretical purity is high, but practical inconvenience seems to be rare.<ref>{{cite web
Perl also has two implicit looping constructs, each of which has two forms:
|url=http://blogs.perl.org/users/jeffrey_kegler/2011/10/perl-and-parsing-11-are-all-perl-programs-parseable.html
|title=Perl and Parsing 11: Are all Perl programs parseable? |last=Kegler |first=Jeffrey |date=October 7, 2011 |access-date=October 25, 2022
|quote=... we seem to be giving up absolutely nothing. Nobody has ever been able to show a practical downside}}</ref>


Other programs that undertake to parse Perl, such as ] and ], have to contend not only with ambiguous ] but also with the ] of Perl parsing in the general case. ]'s PPI project focused on parsing Perl code as a document (retaining its integrity as a document), instead of parsing Perl as executable code (that not even Perl itself can always do). It was Kennedy who first conjectured that "parsing Perl suffers from the 'halting problem',"<ref>{{cite web |url=https://metacpan.org/module/PPI |title=PPI—Parse, Analyze and Manipulate Perl (without perl) |last1=Kennedy |first1=Adam |year=2006 |publisher=] |access-date=September 16, 2013 |archive-date=September 3, 2013 |archive-url=https://web.archive.org/web/20130903091241/https://metacpan.org/module/PPI |url-status=live}}</ref> which was later proved.<ref>{{cite journal |title=Rice's Theorem |journal=The Perl Review |volume=4 |issue=3 |pages=23–29 |date=Summer 2008}} and {{cite journal |title=Perl is Undecidable |journal=The Perl Review |volume=5 |pages=7–11 |date=Fall 2008}}, available online at {{cite web |url=http://www.jeffreykegler.com/Home/perl-and-undecidability |title=Perl and Undecidability |last1=Kegler|first1=Jeffrey |access-date=January 4, 2009 |archive-date=August 17, 2009 |archive-url=https://web.archive.org/web/20090817183115/http://www.jeffreykegler.com/Home/perl-and-undecidability |url-status=live}}</ref>
''results'' = grep { ... } ''list''
''results'' = grep ''expr'', ''list''
''results'' = map { ... } ''list''
''results'' = map ''expr'', ''list''


Perl is distributed with over 250,000 ] for core Perl language and over 250,000 functional tests for core modules. These run as part of the normal build process and extensively exercise the interpreter and its core modules. Perl developers rely on the functional tests to ensure that changes to the interpreter do not introduce ]s; further, Perl users who see that the interpreter passes its functional tests on their system can have a high degree of confidence that it is working properly.{{Citation needed|date=December 2020}}
<code>grep</code> returns all elements of ''list'' for which the controlled block or expression evaluates to true. <code>map</code> evaluates the controlled block or expression for each element of ''list'' and returns a list of the resulting values. These constructs enable a simple ] style.


== Ports ==
Up until the 5.10.0 release, there was no ] in Perl 5. From 5.10.0 onwards, a multi-way branch statement called <code>given</code>/<code>when</code> is available, which takes the following form:
<!--
Perl is available on so many platforms that it makes no sense to keep a long list in this article. List no specific platform unless notable issues exist in running Perl on it.
-->


Perl is ] under both the ] 1.0<ref name="artistic-1.0">{{cite web|url=http://dev.perl.org/licenses/artistic.html|title=The "Artistic License" - dev.perl.org|website=dev.perl.org|access-date=June 24, 2016|archive-date=July 24, 2018|archive-url=https://web.archive.org/web/20180724213601/http://dev.perl.org/licenses/artistic.html|url-status=live}}</ref><ref name="artistic-1.0-git"> {{Webarchive|url=https://web.archive.org/web/20180725033309/http://perl5.git.perl.org/perl.git/blob/HEAD:/Artistic |date=July 25, 2018}} - file on the Perl 5 git repository</ref> and the ].<ref name="licensing">{{cite web |url=http://dev.perl.org/licenses |title=Perl Licensing |access-date=2011-01-08 |publisher=dev.perl.org |archive-date=January 22, 2011 |archive-url=https://web.archive.org/web/20110122175123/http://dev.perl.org/licenses/ |url-status=live}}</ref> Distributions are available for most ]s. It is particularly prevalent on ] and ] systems, but it has been ported to most modern (and many obsolete) platforms. With only six{{citation needed|date=November 2017}} reported exceptions, Perl can be compiled from ] on all ]-compliant, or otherwise-Unix-compatible, platforms.<ref name="cpanports">{{cite web |url=http://www.cpan.org/ports/ |title=Perl Ports (Binary Distributions) |publisher=CPAN.org |last1=Hietaniemi |first1=Jarkko |year=1998 |access-date=April 16, 2006 |archive-date=April 18, 2006 |archive-url=https://web.archive.org/web/20060418115903/http://www.cpan.org/ports/ |url-status=live}}</ref>
given ( ''expr'' ) { when ( ''cond'' ) { ... } default { ... } }


Because of unusual changes required for the ] environment, a special port called MacPerl was shipped independently.<ref name="macperl">{{cite web |url=http://www.macperl.com/ |title=The MacPerl Pages |year=1997 |publisher=Prime Time Freeware |access-date=January 18, 2006 |archive-date=January 18, 2006 |archive-url=https://web.archive.org/web/20060118125208/http://www.macperl.com/ |url-status=live}}</ref>
Syntactically, this structure behaves similarly to ]s found in other languages, but with a few important differences. The largest is that unlike switch/case structures, given/when statements break execution after the first successful branch, rather than waiting for explicitly defined break commands. Conversely, explicit continues are instead necessary to emulate switch behavior.


The ] carries a complete list of supported platforms with links to the distributions available on each.<ref>{{cite web |url=http://www.cpan.org/ports/ |title=Perl Ports (Binary Distributions) |access-date=2011-01-27 |publisher=] |archive-date=April 18, 2006 |archive-url=https://web.archive.org/web/20060418115903/http://www.cpan.org/ports/ |url-status=live}}</ref> CPAN is also the source for publicly available Perl modules that are not part of the core Perl distribution.{{Citation needed|date=December 2020}}
For those not using the 5.10.0 release, the Perl documentation describes a half-dozen ways to achieve the same effect by using other control structures. There is also a module, which provides functionality modeled on the forthcoming ] re-design. It is implemented using a ], so its use is unofficially discouraged.<ref></ref>


ActivePerl is a closed-source distribution from ] that has regular releases that track the core Perl releases.<ref name="activestate">{{cite web |url=http://www.activestate.com/activeperl |title=ActivePerl is Perl for Windows, Mac, Linux, AIX, HP-UX & Solaris |access-date=2011-01-09 |publisher=] Software |archive-url=https://web.archive.org/web/20160331201814/http://www.activestate.com/activeperl |archive-date=March 31, 2016 |url-status=dead}}</ref> The distribution previously included the ] (PPM),<ref name="activestateppm">{{cite web |url=http://docs.activestate.com/activeperl/5.12/faq/ActivePerl-faq2.html |title=Using PPM |access-date=2011-01-09 |publisher=] |archive-date=August 27, 2010 |archive-url=https://web.archive.org/web/20100827110749/http://docs.activestate.com/activeperl/5.12/faq/ActivePerl-faq2.html |url-status=live}}</ref> a popular tool for installing, removing, upgrading, and managing the use of common Perl modules; however, this tool was discontinued as of ActivePerl 5.28.<ref>{{Cite news |last1=Crane |first1=Dana |date=July 23, 2019 |url=https://www.activestate.com/blog/goodbye-ppm-hello-state-tool/ |title=Goodbye PPM, Hello State Tool |website=Activestate.com |access-date=April 16, 2020 |archive-date=July 28, 2020 |archive-url=https://web.archive.org/web/20200728080612/https://www.activestate.com/blog/goodbye-ppm-hello-state-tool/ |url-status=live}}</ref> Included also is ], a ] (WSH) engine implementing the Perl language. ] is an ActiveState tool that adds Perl to the ] ] development suite. A ]-to-Perl converter, a Perl compiler for Windows, and converters of ] and ] to Perl have also been produced by this company and included on the ''ActiveState CD for Windows'', which includes all of their distributions plus the ] and all but the first on the Unix–Linux–POSIX variant thereof in 2002 and afterward.<ref>readme.txt</ref>
Perl includes a <code>goto label</code> statement, but it is rarely used. Situations where a <code>goto</code> is called for in other languages don't occur as often in Perl due to its breadth of flow control options.


== Performance ==
There is also a <code>goto &sub</code> statement that performs a ]. It terminates the current subroutine and immediately calls the specified <code>''sub''</code>. This is used in situations where a caller can perform more efficient ] management than Perl itself (typically because no change to the current stack is required), and in deep recursion tail calling can have substantial positive impact on performance because it avoids the overhead of scope/stack management on return.


] compares the performance of implementations of typical programming problems in several programming languages.<ref>{{cite web |url=http://alioth.debian.org/projects/benchmarksgame/ |title=Alioth: The Computer Language Benchmarks Game: Project Info |access-date=2011-01-13 |publisher=] |archive-url=https://web.archive.org/web/20130325192723/https://alioth.debian.org/projects/benchmarksgame/ |archive-date=March 25, 2013 |url-status=dead |df=mdy-all}}</ref> The submitted Perl implementations typically perform toward the high end of the memory-usage spectrum and give varied speed results. Perl's performance in the benchmarks game is typical for interpreted languages.<ref>{{cite web |url=http://benchmarksgame.alioth.debian.org/u32/which-programs-are-fastest.php?v8=on&lua=on&jruby=on&php=on&python3=on&yarv=on&perl=on |archive-url=https://web.archive.org/web/20130517145336/http://benchmarksgame.alioth.debian.org/u32/which-programs-are-fastest.php?v8=on&lua=on&jruby=on&php=on&python3=on&yarv=on&perl=on |url-status=dead |archive-date=2013-05-17 |title=Which programs are fastest? |access-date=2011-01-13 |work=Computer Language Benchmarks Game |publisher=]}}</ref>
=== Subroutines ===
]s are defined with the <code>sub</code> keyword, and invoked simply by naming them. If the subroutine in question has not yet been declared, invocation requires either parentheses after the function name or an ampersand ('''&''') before it. But using '''&''' without parentheses will also implicitly pass the arguments of the current subroutine to the one called, and using '''&''' with parentheses will bypass prototypes.


Large Perl programs start more slowly than similar programs in compiled languages because Perl has to compile the source every time it runs. In a talk at the ] conference and subsequent article "A Timely Start", Jean-Louis Leroy found that his Perl programs took much longer to run than expected because the perl interpreter spent significant time finding modules within his over-large include path.<ref>{{cite web |url=http://www.perl.com/pub/a/2005/12/21/a_timely_start.html |title=A Timely Start |last1=Leroy |first1=Jean-Louis |date=2005-12-01 |publisher=O'Reilly |access-date=May 22, 2006 |archive-date=June 13, 2006 |archive-url=https://web.archive.org/web/20060613025623/http://www.perl.com/pub/a/2005/12/21/a_timely_start.html |url-status=live}}</ref> Unlike Java, Python, and Ruby, Perl has only experimental support for pre-compiling.<ref>{{cite web |url=https://metacpan.org/module/NWCLARK/perl-5.8.8/ext/B/B/Bytecode.pm#KNOWN-BUGS |title=B::Bytecode Perl compiler's bytecode backend |author1=Beattie, Malcolm |author2=Enache Adrian |name-list-style=amp |year=2003 |publisher=] |access-date=September 16, 2013 |archive-date=March 30, 2021 |archive-url=https://web.archive.org/web/20210330011632/https://metacpan.org/pod/release/NWCLARK/perl-5.8.8/ext/B/B/Bytecode.pm#KNOWN-BUGS |url-status=dead}}</ref> Therefore, Perl programs pay this overhead penalty on every execution. The run phase of typical programs is long enough that ] startup time is not substantial, but benchmarks that measure very short execution times are likely to be skewed due to this overhead.<ref>{{Cite book|last1=Schwartz|first1=Randal|url=https://books.google.com/books?id=va1PSgaO4xIC&q=Therefore,+Perl+programs+pay+this+overhead+penalty+on+every+execution.+The+run+phase+of+typical+programs+is+long+enough+that+amortized+startup+time+is+not+substantial,+but+benchmarks+that+measure+very+short+execution+times+are+likely+to+be+skewed+due+to+this+overhead.|title=Learning Perl|last2=foy|first2=brian|last3=Phoenix|first3=Tom|date=2011-06-23|publisher="O'Reilly Media, Inc."|isbn=978-1-4493-0358-7|language=en}}</ref>
<source lang="perl">
# Calling a subroutine


A number of tools have been introduced to improve this situation. The first such tool was Apache's ], which sought to address one of the most-common reasons that small Perl programs were invoked rapidly: ] ] development. ], via Microsoft ], provides similar performance improvements.<ref>{{Cite book|last1=Stein|first1=Lincoln|url=https://books.google.com/books?id=qyzTI_eAeHUC&q=A+number+of+tools+have+been+introduced+to+improve+this+situation.+The+first+such+tool+was+Apache's+mod+perl,+which+sought+to+address+one+of+the+most-common+reasons+that+small+Perl+programs+were+invoked+rapidly:+CGI+Web+development.+ActivePerl,+via+Microsoft+ISAPI,+provides+similar+performance+improvements.|title=Writing Apache Modules with Perl and C: The Apache API and Mod_perl|last2=MacEachern|first2=Doug|date=1999|publisher="O'Reilly Media, Inc."|isbn=978-1-56592-567-0|language=en}}</ref>
# Parentheses are required here if the subroutine is defined later in the code
foo();
&foo; # (this also works, but has other consequences regarding arguments passed to the subroutine)


Once Perl code is compiled, there is additional overhead during the execution phase that typically isn't present for programs written in compiled languages such as C or C++. Examples of such overhead include ] interpretation, reference-counting memory management, and dynamic type-checking.<ref>{{Cite book|last1=Bekman|first1=Stas|url=https://books.google.com/books?id=UDabAgAAQBAJ&q=Once+Perl+code+is+compiled,+there+is+additional+overhead+during+the+execution+phase+that+typically+isn't+present+for+programs+written+in+compiled+languages+such+as+C+or+C++.+Examples+of+such+overhead+include+bytecode+interpretation,+reference-counting+memory+management,+and+dynamic+type-checking.|title=Practical Mod_perl|last2=Cholet|first2=Eric|date=2003|publisher="O'Reilly Media, Inc."|isbn=978-0-596-00227-5|language=en}}</ref>
# Defining a subroutine
sub foo { ... }


The most critical routines can be written in other languages (such as ]), which can be connected to Perl via simple Inline modules or the more complex, but flexible, ] mechanism.<ref>{{cite web |url=https://metacpan.org/module/Inline |title=Inline - metacpan.org |access-date=2011-01-26 |last=Ingerson |first=Brian |publisher=] |url-status=dead |archive-url=https://web.archive.org/web/20130613163723/https://metacpan.org/module/Inline |archive-date=June 13, 2013}}</ref>
foo; # Here parentheses are not required
</source>


== Applications ==
A list of arguments may be provided after the subroutine name. Arguments may be scalars, lists, or hashes.


Perl has many and varied applications, compounded by the availability of many standard and third-party modules.
<source lang="perl">
foo $x, @y, %z;
</source>
The parameters to a subroutine do not need to be declared as to either number or type; in fact, they may vary from call to call. Any validation of parameters must be performed explicitly inside the subroutine.


Perl has chiefly been used to write ] scripts: large projects written in Perl include ], ], ], ], ], and ]; high-traffic websites that use Perl extensively include ], ],<ref>{{cite book |last1=Gilmore |first1=W. J. |title=Beginning PHP and MySQL: From Novice to Professional, Fourth Edition |year=2010 |url=https://archive.org/details/beginningphpmysq00gilm_240 |url-access=limited |publisher=Apress |page= |isbn=978-1-4302-3114-1}}</ref> ],<ref>{{cite web |title=IMDb Helpdesk: What software/hardware are you using to run the site? |website=Internet Movie Database |url=https://www.imdb.com/help/search?domain=helpdesk_faq&index=1&file=techinfo |access-date=2011-02-12 |archive-date=March 9, 2017 |archive-url=https://web.archive.org/web/20170309083513/http://www.imdb.com/help/search?domain=helpdesk_faq&index=1&file=techinfo |url-status=live}}</ref> ], ],<ref>DuckDuckGo handles a large amount of search queries at 4.5 million queries per day . https://duckduckgo.com/traffic.html {{Webarchive|url=http://webarchive.loc.gov/all/20120215210604/https://duckduckgo.com/traffic.html |date=February 15, 2012}}</ref><ref>DuckDuckGo uses Perl https://web.archive.org/web/20101231135106/http://www.gabrielweinberg.com/blog/2009/03/duck-duck-go-architecture.html</ref> ] and ]. <!-- THIS IS ''not'' A LIST OF EVERY WEBSITE USING PERL. It's a listing of 'high traffic websites'. Please consider traffic volume before adding your own Web site to it. Refs for lesser known websites certainly needed. -->
Arrays are expanded to their elements, hashes are expanded to a list of key/value pairs, and the whole lot is passed into the subroutine as one flat list of scalars.
It is also an optional component of the popular ] technology stack for ], in lieu of ] or ]. Perl is used extensively as a ] in the ] ] distribution.<ref>{{cite web|url=https://wiki.debian.org/PerlFAQ|title=Perl FAQ|quote=Perl is used quite extensively in Debian. Not only are some core functions written in Perl, but there are over 700 packages in unstable that have perl in their name (Mar 2004).|access-date=August 6, 2019|archive-date=August 6, 2019|archive-url=https://web.archive.org/web/20190806111259/https://wiki.debian.org/PerlFAQ|url-status=live}}</ref>


Perl is often used as a ], tying together systems and interfaces that were not specifically designed to interoperate, and for "]",<ref>{{cite web |url=http://books.perl.org/book/95 |title=Perl Books - Book: Data Munging with Perl |work=Perl.org |access-date=December 30, 2010 |archive-date=September 7, 2011 |archive-url=https://web.archive.org/web/20110907020511/http://books.perl.org/book/95 |url-status=live}}</ref> that is, converting or processing large amounts of data for tasks such as creating reports. These strengths are linked intimately. The combination makes Perl a popular all-purpose language for ]s, particularly because short programs, often called "]s", can be entered and run on a single ].{{Citation needed|date=December 2020}}
Whatever arguments are passed are available to the subroutine in the special array <code>@_</code>. The elements of <code>@_</code> are aliased to the actual arguments; changing an element of <code>@_</code> changes the corresponding argument.


Perl code can be made portable across ] and Unix; such code is often used by suppliers of software (both ] (COTS) and bespoke) to simplify packaging and maintenance of software build- and deployment-scripts.{{Citation needed|date=December 2020}}
Elements of <code>@_</code> may be accessed by subscripting it in the usual way.


] and ] are commonly used to add ]s to Perl scripts.
<source lang="perl">
$_, $_
</source>


Perl's text-handling capabilities can be used for generating ] queries; arrays, hashes, and automatic memory management make it easy to collect and process the returned data. For example, in Tim Bunce's ] ] (API), the arguments to the API can be the text of SQL queries; thus it is possible to program in multiple languages at the same time (e.g., for generating a ] using ], ], and SQL in a ]). The use of Perl ] to programmatically customize each of the SQL queries, and the specification of Perl arrays or hashes as the structures to programmatically hold the resulting ]s from each SQL query, allows a high-level mechanism for handling large amounts of data for post-processing by a Perl subprogram.<ref>{{cite book |last=Descartes |first=Alligator |title=Programming the Perl DBI : |year=2000 |publisher=O'Reilly |location=Beijing |isbn=978-1-56592-699-8 |edition=1 |author2=Bunce, Tim |url=https://archive.org/details/programmingperld00desc}}</ref>
However, the resulting code can be difficult to read, and the parameters have ] semantics, which may be undesirable.
In early versions of Perl, database interfaces were created by relinking the interpreter with a ] database library. This was sufficiently difficult that it was done for only a few of the most-important and most widely used databases, and it restricted the resulting <code>perl</code> executable to using just one database interface at a time.<ref>{{Cite web|title=Perl Programming - Principles of Programming Languages|url=https://sites.google.com/a/principlesofprogram.com/www/perl|access-date=2021-05-18|website=sites.google.com|archive-date=October 8, 2020|archive-url=https://web.archive.org/web/20201008130113/https://sites.google.com/a/principlesofprogram.com/www/perl|url-status=dead}}</ref>


In Perl 5, database interfaces are implemented by Perl DBI modules. The DBI (Database Interface) module presents a single, database-independent interface to Perl applications, while the DBD (Database Driver) modules handle the details of accessing some 50 different databases; there are DBD drivers for most ] ] databases.<ref>{{Cite book|last1=Bunce|first1=Tim|url=https://books.google.com/books?id=WfoOrfuwcb8C&q=The+DBI+(Database+Interface)+module+presents+a+single,+database-independent+interface+to+Perl+applications,+while+the+DBD+(Database+Driver)+modules+handle+the+details+of+accessing+some+50+different+databases;+there+are+DBD+drivers+for+most+ANSI+SQL+databases|title=Programming the Perl DBI: Database programming with Perl|last2=Descartes|first2=Alligator|date=2000-02-04|publisher="O'Reilly Media, Inc."|isbn=978-1-4493-1536-8|language=en}}</ref>
One common idiom is to assign <code>@_</code> to a list of named variables.


DBI provides caching for database handles and queries, which can greatly improve performance in long-lived execution environments such as ],<ref>{{cite web |last=Bekman |first=Stas |title=Efficient Work with Databases under mod_perl |url=http://perl.apache.org/docs/1.0/guide/performance.html#Efficient_Work_with_Databases_under_mod_perl |access-date=2007-09-01 |archive-date=August 22, 2007 |archive-url=https://web.archive.org/web/20070822162513/http://perl.apache.org/docs/1.0/guide/performance.html#Efficient_Work_with_Databases_under_mod_perl |url-status=live}}</ref> helping high-volume systems avert load spikes as in the ].<ref>{{Cite book|last=Pachev|first=Sasha|url=https://books.google.com/books?id=vz6PcTdo8VUC&q=DBI+provides+caching+for+database+handles+and+queries,+which+can+greatly+improve+performance+in+long-lived+execution+environments+such+as+mod+perl,%5B100%5D+helping+high-volume+systems+avert+load+spikes+as+in+the+Slashdot+effect|title=Understanding MySQL Internals: Discovering and Improving a Great Database|date=2007-04-10|publisher="O'Reilly Media, Inc."|isbn=978-0-596-55280-0|language=en}}</ref>
<source lang="perl">
my ($x, $y, $z) = @_;
</source>


In modern Perl applications, especially those written using ]s such as ], the DBI module is often used indirectly via ]s such as ], Class::DBI<ref>{{Cite web|url=https://metacpan.org/pod/Class::DBI|title=Class::DBI - Simple Database Abstraction - metacpan.org|website=metacpan.org|access-date=2020-04-08|archive-date=August 6, 2020|archive-url=https://web.archive.org/web/20200806100410/https://metacpan.org/pod/Class::DBI|url-status=live}}</ref> or Rose::DB::Object<ref>{{Cite web|url=https://metacpan.org/pod/Rose::DB::Object|title=Rose::DB::Object - Extensible, high performance object-relational mapper (ORM). - metacpan.org|website=metacpan.org|access-date=2020-04-08|archive-date=August 6, 2020|archive-url=https://web.archive.org/web/20200806085143/https://metacpan.org/pod/Rose::DB::Object|url-status=live}}</ref> that generate SQL queries and handle data transparently to the application author.<ref>{{Cite web|title=T sql querying developer reference|url=http://pdfpremiumfree.com/download/t-sql-querying-developer-reference-pdf/|access-date=2021-05-18|website=pdfpremiumfree.com|language=en}}</ref>
This provides mnemonic parameter names and implements ] semantics. The <code>my</code> keyword indicates that the following variables are lexically scoped to the containing block.


== Community ==
Another idiom is to shift parameters off of <code>@_</code>. This is especially common when the subroutine takes only one argument, or for handling the <code>$self</code> argument in object-oriented modules.


Perl's culture and community has developed alongside the language itself. ] was the first public venue in which Perl was introduced, but over the course of its evolution, Perl's community was shaped by the growth of broadening Internet-based services including the introduction of the World Wide Web. The community that surrounds Perl was, in fact, the topic of Wall's first "State of the Onion" talk.<ref>{{cite web |url=http://grnlight.net/index.php/programming-articles/100-perl-culture |title=Perl Culture (AKA the first State of the Onion) |first=Larry |last=Wall |author-link=Larry Wall |date=2014-05-22 |access-date=May 22, 2014 |archive-date=May 22, 2014 |archive-url=https://web.archive.org/web/20140522141559/http://grnlight.net/index.php/programming-articles/100-perl-culture |url-status=live}}</ref>
<source lang="perl">
my $x = shift;
</source>


State of the Onion is the name for Wall's yearly ]-style summaries on the progress of Perl and its community. They are characterized by his hallmark humor, employing references to Perl's culture, the wider hacker culture, Wall's linguistic background, sometimes his family life, and occasionally even his Christian background.<ref>{{cite web |title=2nd State of the Onion |last1=Wall |first1=Larry |author1-link=Larry Wall |url=http://www.wall.org/~larry/onion/onion.html |access-date=2012-10-12 |archive-date=July 17, 2012 |archive-url=https://web.archive.org/web/20120717014443/http://www.wall.org/~larry/onion/onion.html |url-status=live}} (Search for 'church')</ref> Each talk is first given at various Perl conferences and is eventually also published online.
Subroutines may assign <code>@_</code> to a hash to simulate named arguments; this is recommended in ''Perl Best Practices'' for subroutines that are likely ever to have more than three parameters.<ref>
Damian Conway, '''', p.182</ref>


In email, Usenet, and message board postings, "Just another Perl hacker" (JAPH) programs are a common trend, originated by ], one of the earliest professional Perl trainers.<ref>{{cite newsgroup |last1=Schwartz |first1=Randal L. |author1-link=Randal L. Schwartz |title=Who is Just another Perl hacker? |message-id=m1hfpvh2jq.fsf@halfdome.holdit.com |newsgroup=comp.lang.perl.misc |date=1999-05-02 |url=https://groups.google.com/forum/#!msg/comp.lang.perl.misc/nK-lswsaMec/DBL87v4FxOwJ |access-date=December 5, 2014 |archive-date=July 8, 2012 |archive-url=https://archive.today/20120708165748/http://groups.google.com/group/comp.sys.acorn.programmer/browse_thread/thread/b5fd3717bda6a8d0/d4d3e151a783dffa?lnk=gst&q=ioc%23d4d3e151a783dffa#!msg/comp.lang.perl.misc/nK-lswsaMec/DBL87v4FxOwJ |url-status=live}}</ref> In the parlance of Perl culture, Perl programmers are known as Perl hackers, and from this derives the practice of writing short programs to print out the phrase "Just another Perl hacker{{sic|,}}". In the spirit of the original concept, these programs are moderately obfuscated and short enough to fit into the signature of an email or Usenet message. The "canonical" JAPH as developed by Schwartz includes the comma at the end, although this is often omitted.<ref>{{cite web |url=http://www.perlmonks.org/bare/?node_id=443856 |title=Canonical JAPH |access-date=2011-05-16 |last=Schwartz |first=Randal |author-link=Randal L. Schwartz |date=2005-03-31 |publisher=] |archive-date=July 22, 2011 |archive-url=https://web.archive.org/web/20110722055125/http://www.perlmonks.org/bare/?node_id=443856 |url-status=live}}</ref>
<source lang="perl">
sub function1 {
my %args = @_;
print "'x' argument was '$args{x}'\n";
}
function1( x => 23 );
</source>


{{Anchor|Perl golf}}
Subroutines may return values.
Perl "golf" is the pastime of reducing the number of characters (key "strokes") used in a Perl program to the bare minimum, much in the same way that ] players seek to take as few shots as possible in a round. The phrase's first use<ref name="perl-golf-coined">{{cite newsgroup |last1=Bacon |first1=Greg |title=Re: Incrementing a value in a slice |message-id=7imnti$mjh$1@info2.uah.edu |newsgroup=comp.lang.perl.misc |date=1999-05-28 |url=http://groups.google.com/group/comp.lang.perl.misc/msg/7b97c434492c8d20 |access-date=2011-07-12 |archive-date=July 7, 2011 |archive-url=https://web.archive.org/web/20110707134412/http://groups.google.com/group/comp.lang.perl.misc/msg/7b97c434492c8d20 |url-status=live}}</ref> emphasized the difference between pedestrian code meant to teach a newcomer and terse hacks likely to amuse experienced Perl programmers, an example of the latter being JAPHs that were already used in signatures in Usenet postings and elsewhere. Similar stunts had been an unnamed pastime in the language ] in previous decades. The use of Perl to write a program that performed ] encryption prompted a widespread and practical interest in this pastime.<ref name="rsa">{{cite web |url=http://www.cypherspace.org/rsa/pureperl.html |title=RSA in 5 lines of perl |access-date=2011-01-10 |last=Back |first=Adam |archive-date=January 19, 2011 |archive-url=https://web.archive.org/web/20110119154503/http://www.cypherspace.org/rsa/pureperl.html |url-status=live}}</ref> In subsequent years, the term "]" has been applied to the pastime in other languages.<ref>{{cite web |url=http://codegolf.com/ |title=Code Golf: What is Code Golf? |publisher=29degrees |year=2007 |access-date=November 26, 2018 |archive-url=https://web.archive.org/web/20120113152453/http://codegolf.com/ |archive-date=January 13, 2012 |url-status=dead |df=mdy-all}}</ref> A Perl Golf Apocalypse was held at Perl Conference 4.0 in Monterey, California in July 2000.


As with C, ] competitions were a well known pastime in the late 1990s. The ] was a competition held by ] from 1996 to 2000 that made an arch virtue of Perl's syntactic flexibility. Awards were given for categories such as "most powerful"—programs that made efficient use of space—and "best four-line signature" for programs that fit into four lines of 76 characters in the style of a Usenet ].<ref name="gallo03">{{cite book |last1=Gallo |first1=Felix |title=Games, diversions, and Perl culture: best of the Perl journal |chapter=The Zeroth Obfuscated Perl Contest |editor= Jon Orwant |publisher=O'Reilly Media |year=2003 |chapter-url=http://oreilly.com/catalog/tpj3/chapter/ch43.pdf |access-date=2011-01-12 |url-status=dead |archive-url=https://web.archive.org/web/20091122114544/http://oreilly.com/catalog/tpj3/chapter/ch43.pdf |archive-date=November 22, 2009 |df=mdy-all}}</ref>
<source lang="perl">
return 42, $x, @y, %z;
</source>


Perl poetry is the practice of writing poems that can be compiled as legal Perl code, for example the piece known as "]". Perl poetry is made possible by the large number of English words that are used in the Perl language. New poems are regularly submitted to the community at ].<ref>{{cite web |url=http://www.perlmonks.org/?node_id=1590 |title=Perl Poetry |access-date=2011-01-27 |publisher=] |archive-date=September 27, 2007 |archive-url=https://web.archive.org/web/20070927000904/http://www.perlmonks.org/?node_id=1590 |url-status=live}}</ref>
If the subroutine does not exit via a <code>return</code> statement, then it returns the last expression evaluated within the subroutine body. Arrays and hashes in the return value are expanded to lists of scalars, just as they are for arguments.


==See also==
The returned expression is evaluated in the calling context of the subroutine; this can surprise the unwary.
{{Portal|Free and open-source software|Computer programming}}
* ]
* ]
* ]
* ]


==References==
<source lang="perl">
{{Reflist}}
sub list { (4, 5, 6) }
sub array { @x = (4, 5, 6); @x }


==Further reading==
$x = list; # returns 6 - last element of list
* 6th Edition (2011), O'Reilly. Beginner-level introduction to Perl.
$x = array; # returns 3 - number of elements in list
* 1st Edition (2012), Wrox. A beginner's tutorial for those new to programming or just new to Perl.
@x = list; # returns (4, 5, 6)
* {{Webarchive|url=https://web.archive.org/web/20111222045417/http://onyxneon.com/books/modern_perl/ |date=December 22, 2011}} 2nd Edition (2012), Onyx Neon. Describes Modern Perl programming techniques.
@x = array; # returns (4, 5, 6)
* 4th Edition (2012), O'Reilly. The definitive Perl reference.
</source>
* 2nd Edition (2010), Addison-Wesley. Intermediate- to advanced-level guide to writing idiomatic Perl.
* '']'', {{ISBN|0-596-00313-7}}. Practical Perl programming examples.
* {{cite book |last=Dominus |first=Mark Jason |title=Higher Order Perl |url=http://hop.perl.plover.com/book/ |year=2005 |publisher=Morgan Kaufmann |isbn=978-1-55860-701-9}} Functional programming techniques in Perl.


==External links==
A subroutine can discover its calling context with the <code>wantarray</code> function.
{{Sister project links|commons=Category:Perl (programming language)|v=Topic:Perl|n=no|q=Perl|s=no|b=Perl Programming}}
<!--======== {{No more links}} ========
PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. Misplaced Pages is not a collection of links and must not be used for advertising.


Excessive or inappropriate links WILL BE DELETED. See ] & ] for details.
<source lang="perl">
sub either {
return wantarray ? (1, 2) : 'Oranges';
}


If there are already plentiful links, please propose additions or replacements on this article's discussion page, or submit your link to the relevant category at the Curlie directory (Curlie.org) and link back to that category using the {{Curlie}} template.
$x = either; # returns "Oranges"
@x = either; # returns (1, 2)
</source>


Before adding any links, be sure you have read the External Links style guide. Then stop and reread it again. If you aren't absolutely sure the link is in compliance, ask on the talk page first!
=== Regular expressions ===
See http://en.wikipedia.org/Wikipedia:External_links/Noticeboard#.27Perl.27_external_links
The Perl language includes a specialized syntax for writing ]s (RE, or regexes), and the interpreter contains an engine for matching strings to regular expressions. The regular expression engine uses a ] algorithm, extending its capabilities from simple pattern matching to string capture and substitution. The regular expression engine is derived from regex written by ].
-->
* {{Official website}}


{{Perl|state=expanded}}
The Perl regular expression syntax was originally taken from Unix Version 8 regular expressions. However, it diverged before the first release of Perl, and has since grown to include many more features. Other languages and applications are now adopting ] over ] regular expressions including ], ], ], Microsoft's ]<ref>Microsoft Corp., ".NET Framework Regular Expressions", ''.NET Framework Developer's Guide'', </ref>, and the ].
{{Programming languages}}

Regular expression syntax is extremely compact, owing to history. The first regular expression dialects were only slightly more expressive than ], and the syntax was designed so that an expression would resemble the text it matches{{Fact|date=June 2007}}. This meant using no more than a single punctuation character or a pair of delimiting characters to express the few supported assertions. Over time, the expressiveness of regular expressions grew tremendously, but the syntax design was never revised and continues to rely on punctuation. As a result, regular expressions can be cryptic and extremely dense.

==== Uses ====
The <code>m//</code> (match) operator introduces a regular expression match. (If it is delimited by slashes, as in all the examples here, then the leading <code>m</code> may be omitted for brevity. If the <code>m</code> is present, as in all the following examples, other delimiters can be used in place of slashes.) In the simplest case, an expression like

<source lang="perl">
$x =~ /abc/;
</source>

evaluates to true ] the string <code>$x</code> matches the regular expression <code>abc</code>.

The <code>s///</code> (substitute) operator, on the other hand, specifies a search and replace operation:

<source lang="perl">
$x =~ s/abc/aBc/; # upcase the b
</source>

Another use of regular expressions is to specify delimiters for the <code>split</code> function:

<source lang="perl">
@words = split /,/, $line;
</source>

The <code>split</code> function creates a list of the parts of the string separated by matches of the regular expression. In this example, a line is divided into a list of its comma-separated parts, and this list is then assigned to the <code>@words</code> array.

==== Syntax ====
Portions of a regular expression may be enclosed in parentheses; corresponding portions of a matching string are ''captured''. Captured strings are assigned to the sequential built-in variables <code>$1, $2, $3, ...</code>, and a list of captured strings is returned as the value of the match.

<source lang="perl">
$x =~ /a(.)c/; # capture the character between 'a' and 'c'
</source>

Perl regular expressions can take ''modifiers''. These are single-letter suffixes that modify the meaning of the expression:

<source lang="perl">
$x =~ /abc/i; # case-insensitive pattern match
$x =~ s/abc/aBc/g; # global search and replace
</source>

Since regular expressions can be dense and cryptic because of their compact syntax, the <code>/x</code> modifier was added in Perl to help programmers write more legible regular expressions. It allows programmers to place whitespace and comments ''inside'' regular expressions:

<source lang="perl">
$x =~ /a # match 'a'
. # followed by any character
c # then followed by the 'c'character
/x;
</source>

== Database interfaces ==
Perl is widely favored for database applications. Its text handling facilities are useful for generating ] queries; arrays, hashes and automatic memory management make it easy to collect and process the returned data.

In early versions of Perl, database interfaces were created by relinking the interpreter with a client-side database library. This was sufficiently difficult that it was only done for a few of the most important and widely used databases, and restricted the resulting <code>perl</code> executable to using just one database interface at a time.

In Perl 5, database interfaces are implemented by ] modules. The DBI (Database Interface) module presents a single, database-independent interface to Perl applications, while the DBD (Database Driver) modules handle the details of accessing some 50 different databases; there are DBD drivers for most ] ] databases.

DBI provides caching for database handles and queries, which can greatly improve performance in long-lived execution environments such as ]<ref>{{cite web | last = Bekman | first = Stas | title = Efficient Work with Databases under mod_perl | url = http://perl.apache.org/docs/1.0/guide/performance.html#Efficient_Work_with_Databases_under_mod_perl | accessdate = 2007-09-01 }}</ref>, helping high-volume systems avert load spikes as in the ].

== Comparative performance ==
''The Computer Language Benchmarks Game''<ref></ref> compares the performance of implementations of typical programming problems in several programming languages. The submitted Perl implementations were typically towards the high end of the memory usage spectrum, and had varied speed results. Perl's performance in the benchmarks game is similar to other interpreted languages such as Python, faster than PHP, and significantly faster than Ruby, but slower than most compiled languages.

Perl programs can start slower than similar programs in compiled languages because perl has to compile the source every time it runs. In a talk at the ] conference and subsequent article, "A Timely Start", Jean-Louis Leroy found that his Perl programs took much longer to run than he expected because the perl interpreter spent much of the time finding modules because of his over-large include path.<ref>{{cite web | url=http://www.perl.com/pub/a/2005/12/21/a_timely_start.html | title=A Timely Start | author=Leroy, Jean-Louis | date=2005-12-01 | publisher=Perl.com }}</ref> Because pre-compiling is still an experimental part of Perl<ref>{{cite web | url=http://search.cpan.org/~nwclark/perl-5.8.8/ext/B/B/Bytecode.pm#KNOWN_BUGS | title=B::Bytecode Perl compiler's bytecode backend | author=Beattie, Malcolm and Enache Adrian | year=2003 | publisher=search.cpan.org }}</ref>—unlike that of Java, Python, and Ruby—Perl programs pay this overhead penalty on every execution. When ] over a long run phase, startup time is not typically substantial, but measurement of very short execution times can often be skewed as is often found in benchmarks.

A number of tools have been introduced to improve this situation, the first of which was Apache's ], which sought to address one of the most common reasons that small Perl programs were invoked rapidly: ] ] development. ], via Microsoft ] provides similar performance improvements.

Once Perl code is compiled, there is additional overhead during the execution phase that typically isn't present for programs written in compiled languages like C or C++, including, among many other things, overhead due to bytecode interpretation, reference-counting memory management, and dynamic type checking.

=== Optimizing ===
Perl programs, like any code, can be ] using ] and ] after a readable and correct implementation is finished. In part because of Perl's interpreted nature, writing more efficient Perl will not always be enough to meet one's performance goals for a program.

In such situations, the most critical routines of a Perl program can be written in other languages such as ] or ], which can be connected to Perl via simple Inline modules or the more complex but flexible ] mechanism.<ref>http://search.cpan.org/perldoc/Inline/</ref> Nicholas Clark, a Perl core developer, discusses some Perl design trade-offs and some solutions in ''When perl is not quite fast enough''.<ref></ref>

In extreme cases, optimizing Perl can require intimate knowledge of the interpreter's workings rather than skill with algorithms, the Perl language, or general principles of optimization.{{Fact|date=July 2007}}

== Future ==
{{main|Perl 6}}
At the 2000 ], ] made a case for a major new language initiative.<ref>. Retrieved on 2006 September 28.</ref> This led to a decision to begin work on a redesign of the language, to be called Perl 6. Proposals for new language features were solicited from the Perl community at large, and over 300 ] were submitted.

] spent the next few years digesting the RFCs and synthesizing them into a coherent framework for Perl 6. He has presented his design for Perl 6 in a series of documents called "apocalypses", which are numbered to correspond to chapters in '']'' ("The Camel Book"). The current, not yet finalized specification of Perl 6 is encapsulated in design documents called Synopses, which are numbered to correspond to Apocalypses.

Perl 6 is not intended to be backward compatible, though there will be a compatibility mode.

Thesis work by ], overseen by Larry Wall, considered the possible use of the ] as a runtime for Perl.<ref>{{cite paper
| last = Kuhn
| first = Bradley
| authorlink = Bradley M. Kuhn
| title = Considerations on Porting Perl to the Java Virtual Machine
| publisher = University of Cincinnati
| date = January 2001
| url = http://www.ebb.org/bkuhn/writings/technical/thesis/
| accessdate = 2008-06-28}}</ref> Kuhn's thesis showed this approach to be problematic, and in 2001, it was decided that Perl 6 would run on a cross-language ] called ]. This will mean that other languages targeting the Parrot will gain native access to ], allowing some level of cross-language development.

In 2005 ] created the ] project, an implementation of Perl 6 in ]. This was and continues to act as a test platform for the Perl 6 language (separate from the development of the actual implementation) allowing the language designers to explore. The pugs project spawned an active Perl/Haskell cross-language community centered around the ] #perl6 irc channel.

A number of features in the Perl 6 language now show similarities with Haskell, and Perl 6 has been embraced by the Haskell community as a potential scripting language{{Fact|date=October 2007}}.

], Perl 6, Parrot, and pugs are under active development, and a new module for Perl 5 called ] allows some Perl 6 code to run directly on top of Perl 5.

Development of Perl 5 is also continuing. Perl 5.10 was released in December of 2007, with some new features influenced by the design of Perl 6.

== The Perl community ==
Perl's culture and community has developed alongside the language itself. ] was the first public venue in which Perl was introduced, but over the course of its evolution, Perl's community was shaped by the growth of broadening Internet-based services including the introduction of the World Wide Web. The community that surrounds Perl was, in fact, the topic of Larry Wall's first "State of the Onion" talk.<ref>{{ cite web | url=http://www.wall.org/~larry/keynote/keynote.html | title=Perl Culture (AKA the first State of the Onion) | first=Larry | last=Wall | authorlink=Larry Wall | date=1997-08-20 }}</ref>

=== State of the Onion ===
State of the Onion is the name for Larry Wall’s yearly ]-style summaries on the progress of Perl and its community. They are characterized by his hallmark humor, employing references to Perl’s and the wider hacker culture, as well as Wall’s linguistic and sometimes his Christian background.

Each talk is first given at various Perl conferences and eventually also published online.

=== Pastimes ===
Perl's pastimes have become a defining element of the community. Included among them are trivial and complex uses of the language.

==== JAPHs ====
In email, Usenet and message board postings, "]" (JAPH) programs have become a common trend, originated by ], one of the earliest professional Perl trainers.<ref>{{cite newsgroup | author = ] | title = Who is Just another Perl hacker? | id = m1hfpvh2jq.fsf@halfdome.holdit.com | newsgroup = comp.lang.perl.misc | date = 1999-05-02 | url = http://groups.google.com/groups?selm=m1hfpvh2jq.fsf@halfdome.holdit.com | accessdate = 2007-11-12 }}</ref>

In the parlance of Perl culture, Perl programmers are known as Perl hackers, and from this derives the practice of writing short programs to print out the phrase "],". In the spirit of the original concept, these programs are moderately obfuscated and short enough to fit into the signature of an email or Usenet message. The "canonical" JAPH includes the comma at the end, although this is often omitted.

==== Perl golf ====
Perl "golf" is the pastime of reducing the number of characters (key "strokes") used in a Perl program to the bare minimum, much as how ] players seek to take as few shots as possible in a round. This use of the word "golf" originally focused on the JAPHs used in signatures in Usenet postings and elsewhere, though the same stunts had been an unnamed pastime in the language ] in previous decades. The use of Perl to write a program which performed ] encryption prompted a widespread and practical interest in this pastime.<ref></ref> In subsequent years, code golf has been taken up as a pastime in other languages besides Perl.<ref>{{cite web | url=http://codegolf.com/ | title=Code Golf: What is Code Golf? | publisher=29degrees | date=2007 }}</ref>

==== Obfuscation ====
As with C, ] competitions are a well-known pastime. The annual ] made an arch virtue of Perl's syntactic flexibility.

==== Poetry ====
Similar to obfuscated code and golf, but with a different purpose, Perl poetry is the practice of writing poems that can actually be compiled as legal (although generally non-sensical) Perl code. This hobby is more or less unique to Perl due to the large number of regular English words used in the language. New poems are regularly published in the ] site's Perl Poetry section.<ref> on ]</ref>

==== CPAN Acme ====
There are also many examples of code written purely for entertainment on the ]. <code>Lingua::Romana::Perligata</code>, for example, allows writing programs in ].<ref>{{ cite web | url=http://www.csse.monash.edu.au/~damian/papers/HTML/Perligata.html | title=Lingua::Romana::Perligata -- Perl for the XXI-imum Century | author=Conway, Damian }}</ref> Upon execution of such a program, the module translates its source code into regular Perl and runs it.

The Perl community has set aside the "]" namespace for modules that are fun in nature (but its scope has widened to include exploratory or experimental code or any other module that is not meant to ever be used in production). Some of the Acme modules are deliberately implemented in amusing ways. This includes <code>Acme::Bleach</code>, one of the first modules in the <code>Acme::</code> namespace,<ref>{{cite web | url=http://use.perl.org/~acme/journal/200 | title=use Perl; Journal of acme | date=2001-05-23 | author=Brocard, Leon }}</ref> which allows the program's source code to be "whitened" (i.e., all characters replaced with whitespace) and yet still work.

== Further reading ==
* '']'', Fifth Edition (the ''Llama book''), ISBN 0-596-52010-6
* '']'', ISBN 0-596-00313-7
* '']'', (the ''Camel book''), ISBN 0-596-00027-8

== See also ==
{{portal|Free software|Free Software Portal Logo.svg}}
* ]
* ] instruction at Wikiversity—you can use the training and/or help add to it
* ] (POE)—a framework for writing persistent object-oriented environments with ]s.
* ] (PDL)—a Perl module which allows extending Perl for higher-order scientific processing.
* ] (POD)—a documentation tool for Perl.
* ] (JAPH)
* ]
* ]
* ]
* ]
* ]
* ]
* ] (CGI)

== References ==
{{reflist|2}}

== External links ==
<!-- Before adding any links, make sure you have read the External Links style guide, then stopped and reread it again. If you aren't absolutely sure the link is in compliance, ask on the talk page first -->
{{wikibooks|Perl Programming}}
{{wikiversity2|Topic:Perl}}
* —Official Perl website
*
*
*
* {{dmoz|Computers/Programming/Languages/Perl/|Perl}}
{{Perl}}
{{FOSS}} {{FOSS}}
{{Authority control}}


] ]
] ]
]
]
]
] ]
] ]
] ]
]
]
]
]
] ]
]
] ]
]
] ]
] ]
<!-- Hidden categories below -->

] ]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]

Latest revision as of 04:13, 24 November 2024

Interpreted programming language first released in 1987 For other uses, see Perl (disambiguation). Not to be confused with PEARL (programming language).

Perl
ParadigmMulti-paradigm
Designed byLarry Wall
DeveloperLarry Wall
First appearedDecember 18, 1987; 37 years ago (1987-12-18)
Stable release
  • 5.40.0 / 9 June 2024; 7 months ago (2024-06-09)
  • 5.38.2 / 29 November 2023; 13 months ago (2023-11-29)
Preview release5.41.3 / 29 August 2024; 4 months ago (2024-08-29)
Typing disciplineDynamic
Implementation languageC
OSCross-platform
LicenseArtistic 1.0 or GNU General Public License version 1 or any later version
Filename extensions.plx, .pls, .pl, .pm, .xs, .t, .pod, .cgi, .psgi
Websiteperl.org
Influenced by
AWK, BASIC, C, C++, Lisp, sed, Unix shell
Influenced
CoffeeScript, Groovy, JavaScript, Julia, LPC, PHP, Python, Raku, Ruby, PowerShell

Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".

Perl was developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions. Perl originally was not capitalized and the name was changed to being capitalized by the time Perl 4 was released. The latest release is Perl 5, first released in 1994. From 2000 to October 2019 a sixth version of Perl was in development; the sixth version's name was changed to Raku. Both languages continue to be developed independently by different development teams which liberally borrow ideas from each other.

Perl borrows features from other programming languages including C, sh, AWK, and sed. It provides text processing facilities without the arbitrary data-length limits of many contemporary Unix command line tools. Perl is a highly expressive programming language: source code for a given algorithm can be short and highly compressible.

Perl gained widespread popularity in the mid-1990s as a CGI scripting language, in part due to its powerful regular expression and string parsing abilities. In addition to CGI, Perl 5 is used for system administration, network programming, finance, bioinformatics, and other applications, such as for graphical user interfaces (GUIs). It has been nicknamed "the Swiss Army chainsaw of scripting languages" because of its flexibility and power. In 1998, it was also referred to as the "duct tape that holds the Internet together", in reference to both its ubiquitous use as a glue language and its perceived inelegance.

Name and logos

The Camel symbol used by O'Reilly MediaThe onion logo used by The Perl Foundation

Perl was originally named "Pearl". Wall wanted to give the language a short name with positive connotations. It is also a Christian reference to the Parable of the Pearl from the Gospel of Matthew. However, Wall discovered the existing PEARL language before Perl's official release and dropped the "a" from the name.

The name is occasionally expanded as a backronym: Practical Extraction and Report Language and Wall's own Pathologically Eclectic Rubbish Lister, which is in the manual page for perl.

Programming Perl, published by O'Reilly Media, features a picture of a dromedary camel on the cover and is commonly called the "Camel Book". This image has become an unofficial symbol of Perl. O'Reilly owns the image as a trademark but licenses it for non-commercial use, requiring only an acknowledgement and a link to www.perl.com. Licensing for commercial use is decided on a case-by-case basis. O'Reilly also provides "Programming Republic of Perl" logos for non-commercial sites and "Powered by Perl" buttons for any site that uses Perl.

The Perl Foundation owns an alternative symbol, an onion, which it licenses to its subsidiaries, Perl Mongers, PerlMonks, Perl.org, and others. The symbol is a visual pun on pearl onion.

History

Early versions

Larry Wall began work on Perl in 1987, while employed as a programmer at Unisys; he released version 1.0 on December 18, 1987. Wall based early Perl on some methods existing languages used for text manipulation.

Perl 2, released in June 1988, featured a better regular expression engine. Perl 3, released in October 1989, added support for binary data streams.

1990s

Main article: Perl 5 version history

Originally, the only documentation for Perl was a single lengthy man page. In 1991, Programming Perl, known to many Perl programmers as the "Camel Book" because of its cover, was published and became the de facto reference for the language. At the same time, the Perl version number was bumped to 4, not to mark a major change in the language but to identify the version that was well documented by the book. Perl 4 was released in March 1991.

Perl 4 went through a series of maintenance releases, culminating in Perl 4.036 in 1993, whereupon Wall abandoned Perl 4 to begin work on Perl 5. Initial design of Perl 5 continued into 1994. The perl5-porters mailing list was established in May 1994 to coordinate work on porting Perl 5 to different platforms. It remains the primary forum for development, maintenance, and porting of Perl 5.

Perl 5.000 was released on October 17, 1994. It was a nearly complete rewrite of the interpreter, and it added many new features to the language, including objects, references, lexical (my) variables, and modules. Importantly, modules provided a mechanism for extending the language without modifying the interpreter. This allowed the core interpreter to stabilize, even as it enabled ordinary Perl programmers to add new language features. Perl 5 has been in active development since then.

Perl 5.001 was released on March 13, 1995. Perl 5.002 was released on February 29, 1996 with the new prototypes feature. This allowed module authors to make subroutines that behaved like Perl builtins. Perl 5.003 was released June 25, 1996, as a security release.

One of the most important events in Perl 5 history took place outside of the language proper and was a consequence of its module support. On October 26, 1995, the Comprehensive Perl Archive Network (CPAN) was established as a repository for the Perl language and Perl modules; as of December 2022, it carries over 211,850 modules in 43,865 distributions, written by more than 14,324 authors, and is mirrored worldwide at more than 245 locations.

Perl 5.004 was released on May 15, 1997, and included, among other things, the UNIVERSAL package, giving Perl a base object from which all classes were automatically derived and the ability to require versions of modules. Another significant development was the inclusion of the CGI.pm module, which contributed to Perl's popularity as a CGI scripting language.

Perl 5.004 added support for Microsoft Windows, Plan 9, QNX, and AmigaOS.

Perl 5.005 was released on July 22, 1998. This release included several enhancements to the regex engine, new hooks into the backend through the B::* modules, the qr// regex quote operator, a large selection of other new core modules, and added support for several more operating systems, including BeOS.

2000–2020

Major version Latest update
Old version, no longer maintained: 5.4 1999-04-29
Old version, no longer maintained: 5.5 2004-02-23
Old version, no longer maintained: 5.6 2003-11-15
Old version, no longer maintained: 5.8 2008-12-14
Old version, no longer maintained: 5.10 2009-08-22
Old version, no longer maintained: 5.12 2012-11-10
Old version, no longer maintained: 5.14 2013-03-10
Old version, no longer maintained: 5.16 2013-03-11
Old version, no longer maintained: 5.18 2014-10-01
Old version, no longer maintained: 5.20 2015-09-12
Old version, no longer maintained: 5.22 2017-07-15
Old version, no longer maintained: 5.24 2018-04-14
Old version, no longer maintained: 5.26 2018-11-29
Old version, no longer maintained: 5.28 2020-06-01
Old version, no longer maintained: 5.30 2020-06-01
Old version, no longer maintained: 5.32 2021-01-23
Old version, no longer maintained: 5.34 2023-11-29
Old version, no longer maintained: 5.36 2023-11-29
Old version, yet still maintained: 5.38 2023-11-29
Current stable version: 5.40 2024-06-09
Legend:
Old version
Old version, still maintained
Current stable version
Latest preview version
Future release

Perl 5.6 was released on March 22, 2000. Major changes included 64-bit support, Unicode string representation, support for files over 2 GiB, and the "our" keyword. When developing Perl 5.6, the decision was made to switch the versioning scheme to one more similar to other open source projects; after 5.005_63, the next version became 5.5.640, with plans for development versions to have odd numbers and stable versions to have even numbers.

In 2000, Wall put forth a call for suggestions for a new version of Perl from the community. The process resulted in 361 RFC (Request for Comments) documents that were to be used in guiding development of Perl 6. In 2001, work began on the "Apocalypses" for Perl 6, a series of documents meant to summarize the change requests and present the design of the next generation of Perl. They were presented as a digest of the RFCs, rather than a formal document. At this time, Perl 6 existed only as a description of a language.

Perl 5.8 was first released on July 18, 2002, and further 5.X versions have been released approximately yearly since then. Perl 5.8 improved Unicode support, added a new I/O implementation, added a new thread implementation, improved numeric accuracy, and added several new modules. As of 2013, this version was still the most popular Perl version and was used by Red Hat Linux 5, SUSE Linux 10, Solaris 10, HP-UX 11.31, and AIX 5.

In 2004, work began on the "Synopses" – documents that originally summarized the Apocalypses, but which became the specification for the Perl 6 language. In February 2005, Audrey Tang began work on Pugs, a Perl 6 interpreter written in Haskell. This was the first concerted effort toward making Perl 6 a reality. This effort stalled in 2006.

The Perl On New Internal Engine (PONIE) project existed from 2003 until 2006. It was to be a bridge between Perl 5 and 6, and an effort to rewrite the Perl 5 interpreter to run on the Perl 6 Parrot virtual machine. The goal was to ensure the future of the millions of lines of Perl 5 code at thousands of companies around the world. The PONIE project ended in 2006 and is no longer being actively developed. Some of the improvements made to the Perl 5 interpreter as part of PONIE were folded into that project.

On December 18, 2007, the 20th anniversary of Perl 1.0, Perl 5.10.0 was released. Perl 5.10.0 included notable new features, which brought it closer to Perl 6. These included a switch statement (called "given"/"when"), regular expressions updates, and the smart match operator (~~). Around this same time, development began in earnest on another implementation of Perl 6 known as Rakudo Perl, developed in tandem with the Parrot virtual machine. As of November 2009, Rakudo Perl has had regular monthly releases and now is the most complete implementation of Perl 6.

A major change in the development process of Perl 5 occurred with Perl 5.11; the development community has switched to a monthly release cycle of development releases, with a yearly schedule of stable releases. By that plan, bugfix point releases will follow the stable releases every three months.

On April 12, 2010, Perl 5.12.0 was released. Notable core enhancements include new package NAME VERSION syntax, the yada yada operator (intended to mark placeholder code that is not yet implemented), implicit strictures, full Y2038 compliance, regex conversion overloading, DTrace support, and Unicode 5.2.

On May 14, 2011, Perl 5.14 was released with JSON support built-in.

On May 20, 2012, Perl 5.16 was released. Notable new features include the ability to specify a given version of Perl that one wishes to emulate, allowing users to upgrade their version of Perl, but still run old scripts that would normally be incompatible. Perl 5.16 also updates the core to support Unicode 6.1.

On May 18, 2013, Perl 5.18 was released. Notable new features include the new dtrace hooks, lexical subs, more CORE:: subs, overhaul of the hash for security reasons, support for Unicode 6.2.

On May 27, 2014, Perl 5.20 was released. Notable new features include subroutine signatures, hash slices/new slice syntax, postfix dereferencing (experimental), Unicode 6.3, and a rand() function using a consistent random number generator.

Some observers credit the release of Perl 5.10 with the start of the Modern Perl movement. In particular, this phrase describes a style of development that embraces the use of the CPAN, takes advantage of recent developments in the language, and is rigorous about creating high quality code. While the book Modern Perl may be the most visible standard-bearer of this idea, other groups such as the Enlightened Perl Organization have taken up the cause.

In late 2012 and 2013, several projects for alternative implementations for Perl 5 started: Perl5 in Perl6 by the Rakudo Perl team, moe by Stevan Little and friends, p2 by the Perl11 team under Reini Urban, gperl by goccy, and rperl, a Kickstarter project led by Will Braswell and affiliated with the Perl11 project.

Perl 6 and Raku

Main article: Raku (programming language)
Camelia, the logo for the Perl 6 project

At the 2000 Perl Conference, Jon Orwant made a case for a major new language initiative. This led to a decision to begin work on a redesign of the language, to be called Perl 6. Proposals for new language features were solicited from the Perl community at large, which submitted more than 300 RFCs.

Wall spent the next few years digesting the RFCs and synthesizing them into a coherent framework for Perl 6. He presented his design for Perl 6 in a series of documents called "apocalypses" – numbered to correspond to chapters in Programming Perl. As of January 2011, the developing specification of Perl 6 was encapsulated in design documents called Synopses – numbered to correspond to Apocalypses.

Thesis work by Bradley M. Kuhn, overseen by Wall, considered the possible use of the Java virtual machine as a runtime for Perl. Kuhn's thesis showed this approach to be problematic. In 2001, it was decided that Perl 6 would run on a cross-language virtual machine called Parrot.

In 2005, Audrey Tang created the Pugs project, an implementation of Perl 6 in Haskell. This acted as, and continues to act as, a test platform for the Perl 6 language (separate from the development of the actual implementation), allowing the language designers to explore. The Pugs project spawned an active Perl/Haskell cross-language community centered around the Libera Chat #raku IRC channel. Many functional programming influences were absorbed by the Perl 6 design team.

In 2012, Perl 6 development was centered primarily on two compilers:

  1. Rakudo, an implementation running on the Parrot virtual machine and the Java virtual machine.
  2. Niecza, which targets the Common Language Runtime.

In 2013, MoarVM ("Metamodel On A Runtime"), a C language-based virtual machine designed primarily for Rakudo was announced.

In October 2019, Perl 6 was renamed to Raku.

As of 2017 only the Rakudo implementation and MoarVM are under active development, and other virtual machines, such as the Java Virtual Machine and JavaScript, are supported.

Perl 7

In June 2020, Perl 7 was announced as the successor to Perl 5. Perl 7 was to initially be based on Perl 5.32 with a release expected in first half of 2021, and release candidates sooner.

This plan was revised in May 2021, without any release timeframe or version of Perl 5 for use as a baseline specified. When Perl 7 would be released, Perl 5 would have gone into long term maintenance. Supported Perl 5 versions however would continue to get important security and bug fixes.

Perl 7 was announced on 24 June 2020 at "The Perl Conference in the Cloud" as the successor to Perl 5. Based on Perl 5.32, Perl 7 was planned to be backward compatible with modern Perl 5 code; Perl 5 code, without boilerplate (pragma) header needs adding use compat::perl5; to stay compatible, but modern code can drop some of the boilerplate.

The plan to go to Perl 7 brought up more discussion, however, and the Perl Steering Committee canceled it to avoid issues with backward compatibility for scripts that were not written to the pragmas and modules that would become the default in Perl 7. Perl 7 will only come out when the developers add enough features to warrant a major release upgrade.

Design

Main article: Perl language structure

Philosophy

According to Wall, Perl has two slogans. The first is "There's more than one way to do it," commonly known as TMTOWTDI, (pronounced Tim Toady). As proponents of this motto argue, this philosophy makes it easy to write concise statements.

The second slogan is "Easy things should be easy and hard things should be possible".

The design of Perl can be understood as a response to three broad trends in the computer industry: falling hardware costs, rising labor costs, and improvements in compiler technology. Many earlier computer languages, such as Fortran and C, aimed to make efficient use of expensive computer hardware. In contrast, Perl was designed so that computer programmers could write programs more quickly and easily.

Perl has many features that ease the task of the programmer at the expense of greater CPU and memory requirements. These include automatic memory management; dynamic typing; strings, lists, and hashes; regular expressions; introspection; and an eval() function. Perl follows the theory of "no built-in limits", an idea similar to the Zero One Infinity rule.

Wall was trained as a linguist, and the design of Perl is very much informed by linguistic principles. Examples include Huffman coding (common constructions should be short), good end-weighting (the important information should come first), and a large collection of language primitives. Perl favors language constructs that are concise and natural for humans to write, even where they complicate the Perl interpreter.

Perl's syntax reflects the idea that "things that are different should look different." For example, scalars, arrays, and hashes have different leading sigils. Array indices and hash keys use different kinds of braces. Strings and regular expressions have different standard delimiters.

There is a broad practical bent to both the Perl language and the community and culture that surround it. The preface to Programming Perl begins: "Perl is a language for getting your job done." One consequence of this is that Perl is not a tidy language. It includes many features, tolerates exceptions to its rules, and employs heuristics to resolve syntactical ambiguities. Because of the forgiving nature of the compiler, bugs can sometimes be hard to find. Perl's function documentation remarks on the variant behavior of built-in functions in list and scalar contexts by saying, "In general, they do what you want, unless you want consistency."

Features

The overall structure of Perl derives broadly from C. Perl is procedural in nature, with variables, expressions, assignment statements, brace-delimited blocks, control structures, and subroutines.

Perl also takes features from shell programming. All variables are marked with leading sigils, which allow variables to be interpolated directly into strings. However, unlike the shell, Perl uses sigils on all accesses to variables, and unlike most other programming languages that use sigils, the sigil doesn't denote the type of the variable but the type of the expression. So for example, while an array is denoted by the sigil "@" (for example @arrayname), an individual member of the array is denoted by the scalar sigil "$" (for example $arrayname). Perl also has many built-in functions that provide tools often used in shell programming (although many of these tools are implemented by programs external to the shell) such as sorting, and calling operating system facilities.

Perl takes hashes ("associative arrays") from AWK and regular expressions from sed. These simplify many parsing, text-handling, and data-management tasks. Shared with Lisp is the implicit return of the last value in a block, and all statements are also expressions which can be used in larger expressions themselves.

Perl 5 added features that support complex data structures, first-class functions (that is, closures as values), and an object-oriented programming model. These include references, packages, class-based method dispatch, and lexically scoped variables, along with compiler directives (for example, the strict pragma). A major additional feature introduced with Perl 5 was the ability to package code as reusable modules. Wall later stated that "The whole intent of Perl 5's module system was to encourage the growth of Perl culture rather than the Perl core."

All versions of Perl do automatic data-typing and automatic memory management. The interpreter knows the type and storage requirements of every data object in the program; it allocates and frees storage for them as necessary using reference counting (so it cannot deallocate circular data structures without manual intervention). Legal type conversions – for example, conversions from number to string – are done automatically at run time; illegal type conversions are fatal errors.

Syntax

Perl has been referred to as "line noise" and a "write-only language" by its critics. Randal L. Schwartz in the first edition of the book Learning Perl, in the first chapter states: "Yes, sometimes Perl looks like line noise to the uninitiated, but to the seasoned Perl programmer, it looks like checksummed line noise with a mission in life." He also stated that the accusation that Perl is a write-only language could be avoided by coding with "proper care". The Perl overview document perlintro states that the names of built-in "magic" scalar variables "look like punctuation or line noise". However, the English module provides both long and short English alternatives. perlstyle document states that line noise in regular expressions could be mitigated using the /x modifier to add whitespace.

According to the Perl 6 FAQ, Perl 6 was designed to mitigate "the usual suspects" that elicit the "line noise" claim from Perl 5 critics, including the removal of "the majority of the punctuation variables" and the sanitization of the regex syntax. The Perl 6 FAQ also states that what is sometimes referred to as Perl's line noise is "the actual syntax of the language" just as gerunds and prepositions are a part of the English language. In a December 2012 blog posting, despite claiming that "Rakudo Perl 6 has failed and will continue to fail unless it gets some adult supervision", chromatic stated that the design of Perl 6 has a "well-defined grammar", an "improved type system, a unified object system with an intelligent metamodel, metaoperators, and a clearer system of context that provides for such niceties as pervasive laziness". He also stated that "Perl 6 has a coherence and a consistency that Perl 5 lacks."

In Perl, one could write the "Hello, World!" program as:

print "Hello, World!\n";

Here is a more complex Perl program, that counts down seconds from a given starting value:

#!/usr/bin/perl
use strict;
use warnings;
my ( $remaining, $total );
$remaining=$total=shift(@ARGV);
STDOUT->autoflush(1);
while ( $remaining ) {
 printf ( "Remaining %s/%s \r", $remaining--, $total );
 sleep 1;
}
print "\n";

The Perl interpreter can also be used for one-off scripts on the command line. The following example (as invoked from an sh-compatible shell, such as Bash) translates the string "Bob" in all files ending with .txt in the current directory to "Robert":

$ perl -i.bak -lp -e 's/Bob/Robert/g' *.txt

Implementation

No written specification or standard for the Perl language exists for Perl versions through Perl 5, and there are no plans to create one for the current version of Perl. There has been only one implementation of the interpreter, and the language has evolved along with it. That interpreter, together with its functional tests, stands as a de facto specification of the language. Perl 6, however, started with a specification, and several projects aim to implement some or all of the specification.

Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C. As of 2010, the interpreter is 150,000 lines of C code and compiles to a 1 MB executable on typical machine architectures. Alternatively, the interpreter can be compiled to a link library and embedded in other programs. There are nearly 500 modules in the distribution, comprising 200,000 lines of Perl and an additional 350,000 lines of C code (much of the C code in the modules consists of character encoding tables).

The interpreter has an object-oriented architecture. All of the elements of the Perl language—scalars, arrays, hashes, coderefs, file handles—are represented in the interpreter by C structs. Operations on these structs are defined by a large collection of macros, typedefs, and functions; these constitute the Perl C API. The Perl API can be bewildering to the uninitiated, but its entry points follow a consistent naming scheme, which provides guidance to those who use it.

The life of a Perl interpreter divides broadly into a compile phase and a run phase. In Perl, the phases are the major stages in the interpreter's life-cycle. Each interpreter goes through each phase only once, and the phases follow in a fixed sequence.

Most of what happens in Perl's compile phase is compilation, and most of what happens in Perl's run phase is execution, but there are significant exceptions. Perl makes important use of its capability to execute Perl code during the compile phase. Perl will also delay compilation into the run phase. The terms that indicate the kind of processing that is actually occurring at any moment are compile time and run time. Perl is in compile time at most points during the compile phase, but compile time may also be entered during the run phase. The compile time for code in a string argument passed to the eval built-in occurs during the run phase. Perl is often in run time during the compile phase and spends most of the run phase in run time. Code in BEGIN blocks executes at run time but in the compile phase.

At compile time, the interpreter parses Perl code into a syntax tree. At run time, it executes the program by walking the tree. Text is parsed only once, and the syntax tree is subject to optimization before it is executed, so that execution is relatively efficient. Compile-time optimizations on the syntax tree include constant folding and context propagation, but peephole optimization is also performed.

Perl has a Turing-complete grammar because parsing can be affected by run-time code executed during the compile phase. Therefore, Perl cannot be parsed by a straight Lex/Yacc lexer/parser combination. Instead, the interpreter implements its own lexer, which coordinates with a modified GNU bison parser to resolve ambiguities in the language.

It is often said that "Only perl can parse Perl", meaning that only the Perl interpreter (perl) can parse the Perl language (Perl), but even this is not, in general, true. Because the Perl interpreter can simulate a Turing machine during its compile phase, it would need to decide the halting problem in order to complete parsing in every case. It is a longstanding result that the halting problem is undecidable, and therefore not even Perl can always parse Perl. Perl makes the unusual choice of giving the user access to its full programming power in its own compile phase. The cost in terms of theoretical purity is high, but practical inconvenience seems to be rare.

Other programs that undertake to parse Perl, such as source-code analyzers and auto-indenters, have to contend not only with ambiguous syntactic constructs but also with the undecidability of Perl parsing in the general case. Adam Kennedy's PPI project focused on parsing Perl code as a document (retaining its integrity as a document), instead of parsing Perl as executable code (that not even Perl itself can always do). It was Kennedy who first conjectured that "parsing Perl suffers from the 'halting problem'," which was later proved.

Perl is distributed with over 250,000 functional tests for core Perl language and over 250,000 functional tests for core modules. These run as part of the normal build process and extensively exercise the interpreter and its core modules. Perl developers rely on the functional tests to ensure that changes to the interpreter do not introduce software bugs; further, Perl users who see that the interpreter passes its functional tests on their system can have a high degree of confidence that it is working properly.

Ports

Perl is dual licensed under both the Artistic License 1.0 and the GNU General Public License. Distributions are available for most operating systems. It is particularly prevalent on Unix and Unix-like systems, but it has been ported to most modern (and many obsolete) platforms. With only six reported exceptions, Perl can be compiled from source code on all POSIX-compliant, or otherwise-Unix-compatible, platforms.

Because of unusual changes required for the classic Mac OS environment, a special port called MacPerl was shipped independently.

The Comprehensive Perl Archive Network carries a complete list of supported platforms with links to the distributions available on each. CPAN is also the source for publicly available Perl modules that are not part of the core Perl distribution.

ActivePerl is a closed-source distribution from ActiveState that has regular releases that track the core Perl releases. The distribution previously included the Perl package manager (PPM), a popular tool for installing, removing, upgrading, and managing the use of common Perl modules; however, this tool was discontinued as of ActivePerl 5.28. Included also is PerlScript, a Windows Script Host (WSH) engine implementing the Perl language. Visual Perl is an ActiveState tool that adds Perl to the Visual Studio .NET development suite. A VBScript-to-Perl converter, a Perl compiler for Windows, and converters of AWK and sed to Perl have also been produced by this company and included on the ActiveState CD for Windows, which includes all of their distributions plus the Komodo IDE and all but the first on the Unix–Linux–POSIX variant thereof in 2002 and afterward.

Performance

The Computer Language Benchmarks Game compares the performance of implementations of typical programming problems in several programming languages. The submitted Perl implementations typically perform toward the high end of the memory-usage spectrum and give varied speed results. Perl's performance in the benchmarks game is typical for interpreted languages.

Large Perl programs start more slowly than similar programs in compiled languages because Perl has to compile the source every time it runs. In a talk at the YAPC::Europe 2005 conference and subsequent article "A Timely Start", Jean-Louis Leroy found that his Perl programs took much longer to run than expected because the perl interpreter spent significant time finding modules within his over-large include path. Unlike Java, Python, and Ruby, Perl has only experimental support for pre-compiling. Therefore, Perl programs pay this overhead penalty on every execution. The run phase of typical programs is long enough that amortized startup time is not substantial, but benchmarks that measure very short execution times are likely to be skewed due to this overhead.

A number of tools have been introduced to improve this situation. The first such tool was Apache's mod_perl, which sought to address one of the most-common reasons that small Perl programs were invoked rapidly: CGI Web development. ActivePerl, via Microsoft ISAPI, provides similar performance improvements.

Once Perl code is compiled, there is additional overhead during the execution phase that typically isn't present for programs written in compiled languages such as C or C++. Examples of such overhead include bytecode interpretation, reference-counting memory management, and dynamic type-checking.

The most critical routines can be written in other languages (such as C), which can be connected to Perl via simple Inline modules or the more complex, but flexible, XS mechanism.

Applications

Perl has many and varied applications, compounded by the availability of many standard and third-party modules.

Perl has chiefly been used to write CGI scripts: large projects written in Perl include cPanel, Slash, Bugzilla, RT, TWiki, and Movable Type; high-traffic websites that use Perl extensively include Priceline.com, Craigslist, IMDb, LiveJournal, DuckDuckGo, Slashdot and Ticketmaster. It is also an optional component of the popular LAMP technology stack for Web development, in lieu of PHP or Python. Perl is used extensively as a system programming language in the Debian Linux distribution.

Perl is often used as a glue language, tying together systems and interfaces that were not specifically designed to interoperate, and for "data munging", that is, converting or processing large amounts of data for tasks such as creating reports. These strengths are linked intimately. The combination makes Perl a popular all-purpose language for system administrators, particularly because short programs, often called "one-liner programs", can be entered and run on a single command line.

Perl code can be made portable across Windows and Unix; such code is often used by suppliers of software (both commercial off-the-shelf (COTS) and bespoke) to simplify packaging and maintenance of software build- and deployment-scripts.

Perl/Tk and wxPerl are commonly used to add graphical user interfaces to Perl scripts.

Perl's text-handling capabilities can be used for generating SQL queries; arrays, hashes, and automatic memory management make it easy to collect and process the returned data. For example, in Tim Bunce's Perl DBI application programming interface (API), the arguments to the API can be the text of SQL queries; thus it is possible to program in multiple languages at the same time (e.g., for generating a Web page using HTML, JavaScript, and SQL in a here document). The use of Perl variable interpolation to programmatically customize each of the SQL queries, and the specification of Perl arrays or hashes as the structures to programmatically hold the resulting data sets from each SQL query, allows a high-level mechanism for handling large amounts of data for post-processing by a Perl subprogram. In early versions of Perl, database interfaces were created by relinking the interpreter with a client-side database library. This was sufficiently difficult that it was done for only a few of the most-important and most widely used databases, and it restricted the resulting perl executable to using just one database interface at a time.

In Perl 5, database interfaces are implemented by Perl DBI modules. The DBI (Database Interface) module presents a single, database-independent interface to Perl applications, while the DBD (Database Driver) modules handle the details of accessing some 50 different databases; there are DBD drivers for most ANSI SQL databases.

DBI provides caching for database handles and queries, which can greatly improve performance in long-lived execution environments such as mod_perl, helping high-volume systems avert load spikes as in the Slashdot effect.

In modern Perl applications, especially those written using web frameworks such as Catalyst, the DBI module is often used indirectly via object-relational mappers such as DBIx::Class, Class::DBI or Rose::DB::Object that generate SQL queries and handle data transparently to the application author.

Community

Perl's culture and community has developed alongside the language itself. Usenet was the first public venue in which Perl was introduced, but over the course of its evolution, Perl's community was shaped by the growth of broadening Internet-based services including the introduction of the World Wide Web. The community that surrounds Perl was, in fact, the topic of Wall's first "State of the Onion" talk.

State of the Onion is the name for Wall's yearly keynote-style summaries on the progress of Perl and its community. They are characterized by his hallmark humor, employing references to Perl's culture, the wider hacker culture, Wall's linguistic background, sometimes his family life, and occasionally even his Christian background. Each talk is first given at various Perl conferences and is eventually also published online.

In email, Usenet, and message board postings, "Just another Perl hacker" (JAPH) programs are a common trend, originated by Randal L. Schwartz, one of the earliest professional Perl trainers. In the parlance of Perl culture, Perl programmers are known as Perl hackers, and from this derives the practice of writing short programs to print out the phrase "Just another Perl hacker, [sic]". In the spirit of the original concept, these programs are moderately obfuscated and short enough to fit into the signature of an email or Usenet message. The "canonical" JAPH as developed by Schwartz includes the comma at the end, although this is often omitted.

Perl "golf" is the pastime of reducing the number of characters (key "strokes") used in a Perl program to the bare minimum, much in the same way that golf players seek to take as few shots as possible in a round. The phrase's first use emphasized the difference between pedestrian code meant to teach a newcomer and terse hacks likely to amuse experienced Perl programmers, an example of the latter being JAPHs that were already used in signatures in Usenet postings and elsewhere. Similar stunts had been an unnamed pastime in the language APL in previous decades. The use of Perl to write a program that performed RSA encryption prompted a widespread and practical interest in this pastime. In subsequent years, the term "code golf" has been applied to the pastime in other languages. A Perl Golf Apocalypse was held at Perl Conference 4.0 in Monterey, California in July 2000.

As with C, obfuscated code competitions were a well known pastime in the late 1990s. The Obfuscated Perl Contest was a competition held by The Perl Journal from 1996 to 2000 that made an arch virtue of Perl's syntactic flexibility. Awards were given for categories such as "most powerful"—programs that made efficient use of space—and "best four-line signature" for programs that fit into four lines of 76 characters in the style of a Usenet signature block.

Perl poetry is the practice of writing poems that can be compiled as legal Perl code, for example the piece known as "Black Perl". Perl poetry is made possible by the large number of English words that are used in the Perl language. New poems are regularly submitted to the community at PerlMonks.

See also

References

  1. ^ Ashton, Elaine (1999). "The Timeline of Perl and its Culture (v3.0_0505)". Archived from the original on January 11, 2013. Retrieved March 12, 2004.
  2. "Perl v5.40.0 is now available". www.nntp.perl.org. Retrieved June 11, 2024.
  3. "Perl 5.34.3, Perl 5.36.3 and Perl 5.38.2 are now available". www.nntp.perl.org. Retrieved December 5, 2023.
  4. "Release announcement for perl v5.41.3". www.nntp.perl.org. Retrieved August 29, 2024.
  5. ^ "The "Artistic License" - dev.perl.org". dev.perl.org. Archived from the original on July 24, 2018. Retrieved June 24, 2016.
  6. ^ Artistic Archived July 25, 2018, at the Wayback Machine - file on the Perl 5 git repository
  7. ^ "Perl Licensing". dev.perl.org. Archived from the original on January 22, 2011. Retrieved January 8, 2011.
  8. Wall, Larry (December 12, 2007). "Programming is Hard, Let's Go Scripting..." Archived from the original on July 28, 2017. Retrieved April 14, 2019. All language designers have their occasional idiosyncracies. I'm just better at it than most.
  9. Lapworth, Leo. "General Questions About Perl". Perl FAQ. Perl.org. Archived from the original on May 28, 2013. Retrieved February 24, 2012.
  10. "perl(1): Practical Extraction/Report Language - Linux man page". Linux.die.net. Archived from the original on June 3, 2013. Retrieved July 23, 2013.
  11. ^ Long, Tony. "Dec. 18, 1987: Perl Simplifies the Labyrinth That Is Programming Language". Wired. ISSN 1059-1028. Retrieved February 14, 2023.
  12. Sheppard, Doug (October 16, 2000). "Beginner's Introduction to Perl". dev.perl.org. Archived from the original on June 5, 2011. Retrieved January 8, 2011.
  13. ^ "Larry Wall, the Guru of Perl". Linux Journal. Retrieved August 30, 2023.
  14. "About Perl". perl.org. Archived from the original on November 6, 2015. Retrieved April 20, 2013. "Perl" is a family of languages, "Perl 6" is part of the family, but it is a separate language that has its own development team. Its existence has no significant impact on the continuing development of "Perl 5".
  15. "Path to Raku". GitHub. Archived from the original on November 12, 2020. Retrieved January 14, 2021. This document describes the steps to be taken to effectuate a rename of Perl 6 to Raku
  16. ^ Wall, Larry; Christiansen, Tom; Orwant, Jon (July 2000). Programming Perl, Third Edition. O'Reilly Media. ISBN 978-0-596-00027-1.
  17. "How programs are measured". Computer Language Benchmarks Game, Debian.net. Archived from the original on July 12, 2020. Retrieved October 5, 2020.
  18. "RSA in 3 lines of perl - Everything2.com". everything2.com. Archived from the original on October 8, 2020. Retrieved October 5, 2020.
  19. "Language Evaluations". Archived from the original on March 10, 2015. Retrieved January 30, 2015. Perl's strongest point is its extremely powerful built-in facilities for pattern-directed processing of textual, line-oriented data formats; it is unsurpassed at this.
  20. "You Used Perl to Write WHAT?!". January 24, 2008. Archived from the original on February 4, 2015. Retrieved February 4, 2015. perl has always been the go-to language for any task that involves pattern-matching input
  21. "The Importance of Perl". Archived from the original on February 2, 2015. Retrieved February 4, 2015. Perl's unparalleled ability to process text...
  22. Smith, Roderick W. (June 21, 2002). Advanced Linux Networking. Addison-Wesley Professional. p. 594. ISBN 978-0-201-77423-8.
  23. Sheppard, Doug (October 16, 2000). "Beginner's Introduction to Perl". O'Reilly Media. Archived from the original on June 4, 2008. Retrieved July 27, 2008.
  24. Leonard, Andrew. "The joy of Perl". Salon.com. Archived from the original on July 6, 2012. Retrieved June 5, 2012.
  25. "Scripting on the Lido Deck". Wired. March 7, 2016. Archived from the original on March 7, 2016. Retrieved February 14, 2023.
  26. Richardson, Marjorie (May 1, 1999). "Larry Wall, the Guru of Perl". Linux Journal. Archived from the original on July 20, 2013. Retrieved January 3, 2011.
  27. Schwartz, Randal; foy, brian; Phoenix, Tom (June 16, 2011). Learning Perl. O'Reilly Media, Inc. p. 4. ISBN 978-1449313142. Perl is sometimes called the "Practical Extraction and Report Language", although it has also been called a "Pathologically Eclectic Rubbish Lister", among other expansions. It's actually a backronym, not an acronym, since Larry Wall, Perl's creator, came up with the name first and the expansion later. That's why 'Perl' isn't in all caps. There's no point in arguing that expansion is correct: Larry endorses both.
  28. Wall, Larry. "perl - The Perl language interpreter". Perl 5 version 12.2 documentation. Archived from the original on July 1, 2013. Retrieved January 26, 2011.
  29. ^ Schwartz, Randal L; Phoenix, Tom; Foy, Brian (December 6, 2007). Learning Perl, Third Edition. O'Reilly Media. ISBN 978-0-596-00132-2.
  30. ^ "The Perl Camel Usage and Trademark Information". O'Reilly Media. Archived from the original on April 25, 2018. Retrieved January 9, 2011.
  31. "Perl Trademark". The Perl Foundation. Archived from the original on May 3, 2011. Retrieved January 9, 2011.
  32. Gillmore, Dan (October 25, 1998). "Republic Of Perl". Chicago Tribune. Archived from the original on April 30, 2011. Retrieved January 10, 2011.
  33. ^ Kalita, Jugal (December 2003). On Perl: Perl for Students and Professionals. Universal-Publishers. ISBN 978-1-58112-550-4.
  34. "Perl Culture". docstore.mik.ua. Retrieved March 16, 2023.
  35. Holloway, Ruth. "Perl turns 30 and its community continues to thrive". Opensource.com. Retrieved June 23, 2023.
  36. "Programming Perl, 3rd Edition [Book]". www.oreilly.com. Retrieved April 11, 2023.
  37. "perlhist - the Perl history records - Perldoc Browser". perldoc.perl.org. Retrieved July 28, 2023.
  38. "perl.perl5.porters archive". perl.org. Archived from the original on May 1, 2011. Retrieved January 13, 2011.
  39. ^ "perlhist: the Perl history records". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on January 13, 2011. Retrieved January 21, 2011.
  40. "Perl: Definition, History, & Facts". Britannica.com. Retrieved June 15, 2022.
  41. "CPAN". CPAN. Archived from the original on October 3, 2019. Retrieved December 19, 2022.
  42. ^ "perl5004delta – what's new for perl5.004". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on February 27, 2011. Retrieved January 8, 2011.
  43. Patwardhan, Nathan; Siever, Ellen; Spainhour, Stephen (2002). Perl in a Nutshell, Second Edition. O'Reilly Media. ISBN 978-0-596-00241-1.
  44. "perl5005delta - what's new for perl5.005". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on February 3, 2011. Retrieved January 21, 2011.
  45. "Perl Source". cpan.org. Retrieved November 26, 2023.
  46. "perl56delta - what's new for perl v5.6.0". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on February 2, 2011. Retrieved January 21, 2011.
  47. "perl56delta - what's new for perl v5.6.x". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on November 18, 2010. Retrieved January 21, 2011.
  48. "Perl | Definition, History, & Facts | Britannica". www.britannica.com. Retrieved June 15, 2022.
  49. Wall, Larry. "Apocalypse 1: The Ugly, the Bad, and the Good". Archived from the original on November 23, 2010. Retrieved January 8, 2011.
  50. "perl58delta - what is new for perl v5.8.0". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on November 21, 2010. Retrieved January 21, 2011.
  51. "A Plan for Pugs". O'Reilly Media. March 3, 2005. Archived from the original on September 8, 2012. Retrieved January 27, 2011.
  52. Tang, Audrey (April 21, 2010). "Re: How to Implement Perl 6 in Ten Years". PerlMonks. Archived from the original on May 11, 2011. Retrieved January 3, 2011.
  53. Broadwell, Geoff (August 8, 2005), OSCON 4.4: Inside Ponie, the Bridge from Perl 5 to Perl 6, O'Reilly ONLamp Blog, archived from the original on March 14, 2012, retrieved June 27, 2016
  54. Vincent, Jesse (August 23, 2006), Ponie has been put out to pasture, The Perl Foundation, archived from the original on June 27, 2009, retrieved January 15, 2019
  55. "perl5100delta - what is new for perl 5.10.0". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on December 21, 2010. Retrieved January 8, 2011.
  56. "perlsyn - Perl syntax". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on August 26, 2013. Retrieved January 21, 2011.
  57. "perl5120delta - what is new for perl v5.12.0". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on January 4, 2011. Retrieved January 8, 2011.
  58. "perl5140delta - what is new for perl v5.14.0 - metacpan.org". metacpan.org. Archived from the original on July 25, 2018. Retrieved July 22, 2017.
  59. ^ "perl5160delta - what is new for perl v5.16.0". perldoc.perl.org. Retrieved May 21, 2012.
  60. "perl5180delta - what is new for perl v5.18.0 - Perl programming language". Perl 5 version 18.0 documentation. metacpan.org. Archived from the original on October 29, 2013. Retrieved October 27, 2013.
  61. "perl5200delta - what is new for perl v5.20.0 - Perl programming language". Perl 5 version 20.0 documentation. metacpan.org. Archived from the original on May 27, 2014. Retrieved May 27, 2014.
  62. Milestones in the Perl Renaissance – Modern Perl Programming Archived October 27, 2012, at the Wayback Machine. Modernperlbooks.com. Retrieved on 2013-07-17.
  63. Preface (Modern Perl 2011-2012) Archived September 28, 2012, at the Wayback Machine. Modernperlbooks.com. Retrieved on 2013-07-17.
  64. Modern Perl 2011-2012 edition by chromatic |Onyx Neon Press Archived December 22, 2011, at the Wayback Machine. Onyxneon.com. Retrieved on 2013-07-17.
  65. "Enlightened Perl". Enlightened Perl. Archived from the original on February 5, 2014. Retrieved September 28, 2012.
  66. "YAPC::NA 2013 – June 3–5, Austin, Texas". Yapcna.org. June 4, 2013. Archived from the original on June 22, 2013. Retrieved April 11, 2014.
  67. Little, Stevan (February 8, 2013). "What is Moe (a clarification) | Stevan Little". Blogs.perl.org. Archived from the original on December 19, 2013. Retrieved April 11, 2014.
  68. "p2 on potion". Perl11.org. February 7, 2004. Archived from the original on September 24, 2013. Retrieved April 11, 2014.
  69. "goccy/gperl 路 GitHub". GitHub.com. Archived from the original on February 23, 2015. Retrieved April 11, 2014.
  70. "rperl". RPerl.org. Archived from the original on October 18, 2014. Retrieved August 11, 2014.
  71. "Perl 6". The Perl 6 Project. Archived from the original on February 21, 2011. Retrieved February 27, 2011.
  72. Torkington, Nathan. "Transcription of Larry's talk". nntp.perl.org. Archived from the original on May 1, 2011. Retrieved January 25, 2011.
  73. "Perl6 - The future of Perl". www.java-samples.com. Retrieved May 18, 2021.
  74. "Official Perl 6 Documentation". The Perl 6 Project. Archived from the original on August 31, 2009. Retrieved January 25, 2011.
  75. Kuhn, Bradley M. (January 2001). Considerations on Porting Perl to the Java Virtual Machine (MS thesis). University of Cincinnati. Archived from the original on March 21, 2008. Retrieved June 28, 2008.
  76. chromatic (2015). Modern Perl. Pragmatic Bookshelf. ISBN 978-1-68050-088-2.
  77. "Feature comparison of Perl 6 compilers". Archived from the original on August 11, 2017. Retrieved March 28, 2012.
  78. Worthington, Jonathan (July 15, 2013). "Rakudo JVM News: More tests, plus Thread and Promise prototypes". 6guts. Archived from the original on October 5, 2013. Retrieved July 24, 2013.
  79. Worthington, Jonathan (May 31, 2013). "MoarVM: A virtual machine for NQP and Rakudo". 6guts. Archived from the original on July 9, 2013. Retrieved July 24, 2013.
  80. "rename-lwn". Archived from the original on October 17, 2019. Retrieved November 10, 2019.
  81. "rakudo/rakudo - GitHub". GitHub.com. Archived from the original on July 29, 2017. Retrieved September 21, 2013.
  82. ^ "Perl 7 announced at Perl Conference in the Cloud". perlfoundation.org. June 24, 2020. Archived from the original on June 26, 2020. Retrieved June 24, 2020.
  83. ^ "Announcing Perl 7". perl.com. June 24, 2020. Archived from the original on June 24, 2020. Retrieved June 24, 2020.
  84. Clark, Nicholas (May 9, 2021). "Steering Council meeting #019 2021-05-06". www.nntp.perl.org. Archived from the original on May 18, 2021. Retrieved May 17, 2021. The plan remains that there will be a Perl 7 bump, but not immediately after 5.34.0 is released. ... We don't think that we can deliver on in 12 months.
  85. Preparing for Perl 7d. leanpub.com. June 24, 2020. Archived from the original on June 25, 2020. Retrieved June 24, 2020.
  86. Perl Steering Council. "What happened to Perl 7?". blogs.perl.org. Retrieved July 7, 2022.
  87. Richardson, Marjorie. "Larry Wall, the Guru of Perl | Linux Journal". www.linuxjournal.com. Linux Journal. Retrieved January 16, 2023.
  88. Schwartz, Alan (December 1998). "Tutorial: Perl, a psychologically efficient reformatting language". Behavior Research Methods, Instruments, & Computers. 30 (4): 605–609. doi:10.3758/BF03209477. ISSN 0743-3808. S2CID 61028367.
  89. Gilbert, James G. R. (March 2002). "How to become a programming tadpole". Nature Biotechnology. 20 (3): 221. doi:10.1038/nbt0302-221. ISSN 1087-0156. S2CID 38728402.
  90. "The Fall Of Perl, The Web's Most Promising Language". FastCompany. February 13, 2014.
  91. Wall, Larry. "perl - The Perl 5 language interpreter - Perldoc Browser". perldoc.perl.org. Retrieved June 24, 2021.
  92. Wall, Larry (March 1, 1997). "Wherefore Art, Thou?". Linux Journal. Archived from the original on December 9, 2010. Retrieved March 13, 2011.
  93. "perlfunc - Perl builtin functions". Perl 5 version 12.2 documentation. perldoc.perl.org. Archived from the original on January 6, 2011. Retrieved January 10, 2011.
  94. Nagpal, D.P. (2010). Web Design Technology. India: S. Chand. p. 700. ISBN 978-8121927635.
  95. "title unknown". May 10, 1997. Usenet: 199705101952.MAA00756@wall.org.
  96. "Developer Update". Dr. Dobb's Developer Update. 2. Miller-Freeman. 1995.
  97. ^ Schwartz, Randal L. (1993). Learning Perl. O'Reilly & Associates. Bibcode:1993lepe.book.....S.
  98. "perlintro". Perl 5 version 18.0 documentation. Perl 5 Porters and perldoc.perl.org. Archived from the original on January 9, 2011. Retrieved June 30, 2013.
  99. "perlstyle". Perl 5 version 18.0 documentation. Perl 5 Porters and perldoc.perl.org. Archived from the original on June 26, 2013. Retrieved June 30, 2013.
  100. ^ "Perl 6 FAQ". Perl 6 Project. Archived from the original on July 1, 2013. Retrieved June 30, 2013.
  101. ^ chromatic (December 31, 2012). "The Implementation of Perl 5 versus Perl 6". Archived from the original on July 29, 2013. Retrieved June 30, 2013.
  102. "Perl 6 Specification". The Perl 6 Project. Archived from the original on December 2, 2009. Retrieved January 27, 2011.
  103. "Perl 6 Compilers". The Perl 6 Project. Archived from the original on December 2, 2009. Retrieved January 27, 2011.
  104. A description of the Perl 5 interpreter can be found in Programming Perl, 3rd Ed., chapter 18. See particularly page 467, which carefully distinguishes run phase and compile phase from run time and compile time. Perl "time" and "phase" are often confused.
  105. "perlguts - Introduction to the Perl API - Perldoc Browser". perldoc.perl.org. Retrieved January 24, 2022.
  106. Schwartz, Randal. "On Parsing Perl". Archived from the original on September 27, 2007. Retrieved January 3, 2007.
  107. "The Perl Journal #19/9.26" (PDF). O'Reilly Media. Retrieved February 4, 2011.
  108. Kegler, Jeffrey (October 7, 2011). "Perl and Parsing 11: Are all Perl programs parseable?". Retrieved October 25, 2022. ... we seem to be giving up absolutely nothing. Nobody has ever been able to show a practical downside
  109. Kennedy, Adam (2006). "PPI—Parse, Analyze and Manipulate Perl (without perl)". CPAN. Archived from the original on September 3, 2013. Retrieved September 16, 2013.
  110. "Rice's Theorem". The Perl Review. 4 (3): 23–29. Summer 2008. and "Perl is Undecidable". The Perl Review. 5: 7–11. Fall 2008., available online at Kegler, Jeffrey. "Perl and Undecidability". Archived from the original on August 17, 2009. Retrieved January 4, 2009.
  111. Hietaniemi, Jarkko (1998). "Perl Ports (Binary Distributions)". CPAN.org. Archived from the original on April 18, 2006. Retrieved April 16, 2006.
  112. "The MacPerl Pages". Prime Time Freeware. 1997. Archived from the original on January 18, 2006. Retrieved January 18, 2006.
  113. "Perl Ports (Binary Distributions)". CPAN. Archived from the original on April 18, 2006. Retrieved January 27, 2011.
  114. "ActivePerl is Perl for Windows, Mac, Linux, AIX, HP-UX & Solaris". ActiveState Software. Archived from the original on March 31, 2016. Retrieved January 9, 2011.
  115. "Using PPM". ActiveState Software. Archived from the original on August 27, 2010. Retrieved January 9, 2011.
  116. Crane, Dana (July 23, 2019). "Goodbye PPM, Hello State Tool". Activestate.com. Archived from the original on July 28, 2020. Retrieved April 16, 2020.
  117. readme.txt
  118. "Alioth: The Computer Language Benchmarks Game: Project Info". Alioth. Archived from the original on March 25, 2013. Retrieved January 13, 2011.
  119. "Which programs are fastest?". Computer Language Benchmarks Game. Alioth. Archived from the original on May 17, 2013. Retrieved January 13, 2011.
  120. Leroy, Jean-Louis (December 1, 2005). "A Timely Start". O'Reilly. Archived from the original on June 13, 2006. Retrieved May 22, 2006.
  121. Beattie, Malcolm & Enache Adrian (2003). "B::Bytecode Perl compiler's bytecode backend". CPAN. Archived from the original on March 30, 2021. Retrieved September 16, 2013.
  122. Schwartz, Randal; foy, brian; Phoenix, Tom (June 23, 2011). Learning Perl. "O'Reilly Media, Inc.". ISBN 978-1-4493-0358-7.
  123. Stein, Lincoln; MacEachern, Doug (1999). Writing Apache Modules with Perl and C: The Apache API and Mod_perl. "O'Reilly Media, Inc.". ISBN 978-1-56592-567-0.
  124. Bekman, Stas; Cholet, Eric (2003). Practical Mod_perl. "O'Reilly Media, Inc.". ISBN 978-0-596-00227-5.
  125. Ingerson, Brian. "Inline - metacpan.org". CPAN. Archived from the original on June 13, 2013. Retrieved January 26, 2011.
  126. Gilmore, W. J. (2010). Beginning PHP and MySQL: From Novice to Professional, Fourth Edition. Apress. p. 484. ISBN 978-1-4302-3114-1.
  127. "IMDb Helpdesk: What software/hardware are you using to run the site?". Internet Movie Database. Archived from the original on March 9, 2017. Retrieved February 12, 2011.
  128. DuckDuckGo handles a large amount of search queries at 4.5 million queries per day . https://duckduckgo.com/traffic.html Archived February 15, 2012, at the Library of Congress Web Archives
  129. DuckDuckGo uses Perl https://web.archive.org/web/20101231135106/http://www.gabrielweinberg.com/blog/2009/03/duck-duck-go-architecture.html
  130. "Perl FAQ". Archived from the original on August 6, 2019. Retrieved August 6, 2019. Perl is used quite extensively in Debian. Not only are some core functions written in Perl, but there are over 700 packages in unstable that have perl in their name (Mar 2004).
  131. "Perl Books - Book: Data Munging with Perl". Perl.org. Archived from the original on September 7, 2011. Retrieved December 30, 2010.
  132. Descartes, Alligator; Bunce, Tim (2000). Programming the Perl DBI : [database programming with Perl] (1 ed.). Beijing : O'Reilly. ISBN 978-1-56592-699-8.
  133. "Perl Programming - Principles of Programming Languages". sites.google.com. Archived from the original on October 8, 2020. Retrieved May 18, 2021.
  134. Bunce, Tim; Descartes, Alligator (February 4, 2000). Programming the Perl DBI: Database programming with Perl. "O'Reilly Media, Inc.". ISBN 978-1-4493-1536-8.
  135. Bekman, Stas. "Efficient Work with Databases under mod_perl". Archived from the original on August 22, 2007. Retrieved September 1, 2007.
  136. Pachev, Sasha (April 10, 2007). Understanding MySQL Internals: Discovering and Improving a Great Database. "O'Reilly Media, Inc.". ISBN 978-0-596-55280-0.
  137. "Class::DBI - Simple Database Abstraction - metacpan.org". metacpan.org. Archived from the original on August 6, 2020. Retrieved April 8, 2020.
  138. "Rose::DB::Object - Extensible, high performance object-relational mapper (ORM). - metacpan.org". metacpan.org. Archived from the original on August 6, 2020. Retrieved April 8, 2020.
  139. "T sql querying developer reference". pdfpremiumfree.com. Retrieved May 18, 2021.
  140. Wall, Larry (May 22, 2014). "Perl Culture (AKA the first State of the Onion)". Archived from the original on May 22, 2014. Retrieved May 22, 2014.
  141. Wall, Larry. "2nd State of the Onion". Archived from the original on July 17, 2012. Retrieved October 12, 2012. (Search for 'church')
  142. Schwartz, Randal L. (May 2, 1999). "Who is Just another Perl hacker?". Newsgroupcomp.lang.perl.misc. Usenet: m1hfpvh2jq.fsf@halfdome.holdit.com. Archived from the original on July 8, 2012. Retrieved December 5, 2014.
  143. Schwartz, Randal (March 31, 2005). "Canonical JAPH". PerlMonks. Archived from the original on July 22, 2011. Retrieved May 16, 2011.
  144. Bacon, Greg (May 28, 1999). "Re: Incrementing a value in a slice". Newsgroupcomp.lang.perl.misc. Usenet: 7imnti$mjh$1@info2.uah.edu. Archived from the original on July 7, 2011. Retrieved July 12, 2011.
  145. Back, Adam. "RSA in 5 lines of perl". Archived from the original on January 19, 2011. Retrieved January 10, 2011.
  146. "Code Golf: What is Code Golf?". 29degrees. 2007. Archived from the original on January 13, 2012. Retrieved November 26, 2018.
  147. Gallo, Felix (2003). "The Zeroth Obfuscated Perl Contest" (PDF). In Jon Orwant (ed.). Games, diversions, and Perl culture: best of the Perl journal. O'Reilly Media. Archived from the original (PDF) on November 22, 2009. Retrieved January 12, 2011.
  148. "Perl Poetry". PerlMonks. Archived from the original on September 27, 2007. Retrieved January 27, 2011.

Further reading

External links

Perl
Things
Frameworks
Software
Related
Books
People
Programming languages
Free and open-source software
General
Software
packages
Community
Organisations
Licenses
Types and
standards
Challenges
Related
topics
Categories: