Perl facts for kids
![]() |
|
Paradigm | Multi-paradigm |
---|---|
Designed by | Larry Wall |
Developer | Larry Wall |
First appeared | December 18, 1987 |
Stable release |
|
Preview release |
5.39.10 / 27 April 2024
|
Typing discipline | Dynamic |
Implementation language | C |
OS | Cross-platform |
License | Artistic License 1.0 or GNU General Public License version 1 or any later version |
Filename extensions | .plx, .pls, .pl, .pm, .xs, .t, .pod, .cgi, .psgi |
Influenced by | |
AWK, BASIC, C, C++, Lisp, sed, Unix shell | |
Influenced | |
CoffeeScript, Groovy, JavaScript, Julia, LPC, PHP, Python, Raku, Ruby, PowerShell | |
|
Perl is a powerful programming language that helps computers understand instructions. It's known for being very flexible and can be used for many different tasks. Even though "Perl" isn't officially an acronym, some people say it stands for "Practical Extraction and Reporting Language."
Larry Wall created Perl in 1987. He wanted a language that could easily process reports on Unix systems. Since then, Perl has grown a lot. The current main version is Perl 5, first released in 1994. Another version, Perl 6, was developed later and is now called Raku. Both Perl and Raku are still being improved by different teams.
Perl uses ideas from other programming languages like C and AWK. It's great at handling text and doesn't have limits on how much data it can process. This makes Perl code often short and easy to write.
In the 1990s, Perl became very popular for creating CGI scripts for websites. This was because it was excellent at working with text and finding patterns. Today, Perl 5 is used for managing computer systems, network programming, finance, and even making GUIs (the visual parts of programs). People sometimes call it "the Swiss Army chainsaw of scripting languages" because it's so useful!
Contents
Perl's Symbols and Names
Perl was first called "Pearl." Larry Wall wanted a short, positive name. It also connected to a story in the Bible. But before releasing it, Wall found another language already named PEARL. So, he changed the spelling to "Perl" and removed the "a."
Sometimes, people create funny meanings for the name Perl. One is "Practical Extraction and Report Language." Another, made by Wall himself, is "Pathologically Eclectic Rubbish Lister."
The book Programming Perl has a picture of a camel on its cover. Because of this, the camel became an unofficial symbol for Perl. The company O'Reilly Media owns this camel image. They let people use it for free for non-commercial things, as long as they give credit.
The Perl Foundation uses a different symbol: an onion. This is a clever play on words, as "pearl onion" sounds like "Perl onion."
Another logo, a raptor dinosaur, was created by Sebastian Riedel. This logo is also available for others to use.
A Brief History of Perl
How Perl Started
Larry Wall started working on Perl in 1987 while he was a programmer at Unisys. He released the first version, Perl 1.0, on December 18, 1987. Early Perl versions were good at handling text, like other languages at the time.
Perl 2 came out in June 1988 and was better at finding text patterns. Perl 3, released in October 1989, could work with different types of data.
Perl in the 1990s
For a while, the only guide for Perl was a long manual page. In 1991, the book Programming Perl was published. This book, known as the "Camel Book," became the main guide for Perl programmers. Around this time, Perl's version number became 4, mostly because of the new book.
Larry Wall then started working on Perl 5. It was a big change, almost a complete rewrite of the language. Perl 5.000 was released on October 17, 1994. It added many new features, like objects and modules. Modules were important because they let people add new features without changing the main Perl program. This helped Perl 5 become very stable.
A very important event for Perl 5 happened in October 1995. The Comprehensive Perl Archive Network (CPAN) was created. CPAN is a huge online library where Perl programmers can share their modules. As of December 2022, it has over 211,850 modules!
Perl 5.004, released in May 1997, added support for Microsoft Windows. It also included the CGI.pm module, which made Perl even more popular for creating web pages.
Perl's Journey from 2000 to Today
Perl 5.6 came out in March 2000. It added support for 64-bit computers and Unicode, which helps computers understand text from different languages.
Around 2000, Larry Wall asked the Perl community for ideas for a new version, Perl 6. This led to many suggestions. In 2001, work began on "Apocalypses," documents that described the design for Perl 6.
Perl 5.8 was released in July 2002. It improved Unicode support and added new features. Since then, new versions of Perl 5 have been released almost every year, with improvements and new modules.
In 2019, Perl 6 was officially renamed to Raku. This helped show that it's a separate language, even though it shares history with Perl. Both languages continue to be developed.
In June 2020, there was talk about a new version called Perl 7. It was meant to be based on Perl 5.32 and make modern Perl code easier to write. However, this plan was changed. The developers decided that Perl 7 will only be released when there are enough new features to make it a truly major upgrade.
How Perl is Designed
Perl's Main Ideas
Larry Wall, Perl's creator, had two main ideas for the language. The first is "There's more than one way to do it," often shortened to TMTOWTDI (pronounced "Tim Toady"). This means you can solve a problem in many different ways using Perl. This flexibility makes it easy to write short and clear code.
The second idea is "Easy things should be easy and hard things should be possible." This means Perl tries to make simple tasks very straightforward. For complex tasks, it gives you the tools to get them done, even if they are challenging.
Perl was designed to help programmers write programs faster and easier. This was important because computer hardware was becoming cheaper, but the cost of programmers' time was going up. Perl helps save time by doing things like managing computer memory automatically.
Wall studied languages, and Perl's design is like a human language. Common things are short, and important information comes first. Perl has many built-in tools that make it easy for humans to write code, even if it makes the computer work a bit harder.
What Perl Can Do
Perl is similar to the C programming language. It uses variables, expressions, and blocks of code. It also has features from shell programming, like using special symbols (called sigils) before variable names. For example, `@arrayname` is a list, but `$arrayname[3]` is a single item from that list.
Perl also took ideas from AWK, like "hashes" (which store information in pairs, like a dictionary). It also uses "regular expressions" from sed, which are super powerful for finding and changing text patterns. These features make Perl great for handling text and data.
Perl 5 added more advanced features, like object-oriented programming. This lets programmers organize their code into reusable parts called "modules." Larry Wall said that the goal of Perl 5's module system was to help the Perl community grow.
Perl automatically figures out what type of data you are using (like numbers or text). It also manages memory for you, so you don't have to worry about it. This makes programming easier and helps prevent common errors.
How Perl Code Looks
Some people say Perl code looks like "line noise" because it can use many special characters. However, experienced Perl programmers see it as a powerful and compact way to write code. The Perl team has worked to make the code look cleaner in newer versions.
Here's a simple Perl program that prints "Hello, World!":
print "Hello, World!\n";
And here's a more complex example that counts down seconds:
#!/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";
Perl can also be used for quick tasks directly from the command line. For example, this command changes "Bob" to "Robert" in all text files in a folder:
$ perl -i.bak -lp -e 's/Bob/Robert/g' *.txt
Where Perl is Used
Perl is used for many different things, especially because of all the modules available on CPAN.
Perl was very popular for creating CGI scripts for websites. Many big websites and tools were built with Perl, like cPanel, Bugzilla, Craigslist, and IMDb. It's also part of the popular LAMP setup for web development.
Perl is often called a "glue language." This means it's great at connecting different computer systems or programs that weren't originally designed to work together. It's also good for "data munging," which means cleaning up or processing large amounts of data. System administrators often use Perl for these tasks because they can write short programs to get things done quickly.
Perl programs can work on both Windows and Unix computers. This makes it easy for companies to package and maintain their software.
You can also use Perl to create programs with GUIs (visual windows and buttons) using tools like Perl/Tk and wxPerl.
Perl is also used to talk to databases. The Perl DBI (Database Interface) module lets Perl programs connect to many different types of databases. This is very useful for web applications that need to store and retrieve lots of information.
The Perl Community
The community around Perl has grown and changed along with the language. It started on Usenet and expanded with the internet and the World Wide Web. Larry Wall often gives talks called "State of the Onion" where he shares updates about Perl and its community. These talks are known for their humor and insights.
A fun tradition in the Perl community is "Just another Perl hacker" (JAPH) programs. These are short, clever pieces of Perl code that print the phrase "Just another Perl hacker." Programmers often try to make them as short and tricky as possible.
Perl golf is another fun activity where programmers try to write a Perl program using the fewest characters possible. It's like a game where you want the lowest "score" (number of characters).
There are also Perl poetry competitions! This is where people write poems that are also valid Perl code. It's possible because Perl uses many English words in its language. New Perl poems are often shared on websites like PerlMonks.