Learn About Perl Programming: Get Started With This Dynamic Language
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Perl Introduction and History
Perl is a scripting language that has been around since 1987. While Perl isn’t actually an acronym, there are a few “backronyms” associated with it, with “Practical Extraction and Reporting Language” as the most serious one. As an interpreted language it does not need to compile, it can be used directly in writing perl scripts (.pl files).
Originally created with the intended use of making file processing in Unix easier, becoming what can be called a “Glue Language” that emphasizes practical use and has a lot of power for manipulating text.
Larry Wall designed and developed the language, borrowing from aspects of C, shell script, AWK, and sed. One it’s most useful features is its ability to easily use regular expressions in manipulating text and parsing strings. This has given it the affection moniker of being “the Swiss Army chainsaw of scripting languages.” It does have a lot of influence from the C language in terms of how it deals with variables, expressions, control structures and subroutines, but it is different in many ways too.
What Perl adds that is so unique is the functionality for shell programming and text manipulation. In college, Larry Wall studied both linguistics and computer science, and was able to create his own major which he called “natural and artificial languages.” This is highly reflected in how he sees Perl, referring to ‘variables, functions and accessors’ as ‘nouns, verbs, and topicalizers.’
Within the language itself, the use of “sigils” is highly important for manipulating text within an expression. An “@” character indicates and array, while scalars use $, and hashes use %.
Why Learn Perl? What are alternatives?
Perl is touted for its close proximity for manipulating text, and is described as being more closely related to natural human language than others. Perl was extremely useful for writing CGI scripts during the early commercial period of the internet in the late 1990’s and early 2000’s. Since then, Python, Ruby, PHP, .NET, and JAVA, and recently NodeJS, have all become more competitive for use in general purpose web server code. What Perl 5 is still great at can be summarized as:
- Data Mining & Text Analysis – with Perl’s heavy Regex capabilities, it can sort text easily and is thereby useful in text document processing.
- UNIX system administration – it can run scripts to check on systems, rename and manage system logs, direct the flow of generated files.
- Network Prototyping & Security – many network engineers entered their career when Perl was very popular, and most security experts know Perl, it is good for ‘sketching’ networks & planning how to do security. Being able to manipulate text is great for encryption.
- Catalog Management in Sciences – list heavy research fields need to have a way to quickly modify thousands of items, whether its in a text list, a set of files, or information in a database. Perl can help with this process, it is a great way to deal with a multitude of cataloging conventions.
- Legacy Web Systems & Intranets – long standing tools that are tough to replace. This isn’t a strong leg to stand on, but it deserves mention.
There was also a sort of “grudge match” between Perl and Python. Taking off in the early 2000’s, Python started to become a more favored scripting language in universities, and that spilled over into industry. Python might be younger, but it is object oriented, and since the mid-2000’s its use has risen steadily year after year. See for yourself at the PYPL index. This doesn’t mean that Perl became less useful, just that it has returned to its original intended usage, it never was supposed to be the sole languages of the internet. Timing is important, and during the early consumer internet era, Perl was hacked into becoming a useful web programming tool.
Good Resources for Learning Perl
First it is recommended that you get introduced to the concepts and intent of the Perl language, this perhaps is easiest by watching some videos of Larry Wall explaining why he made the language, how it works, and why people love it.
Videos Introductions to Concepts
- Hacker Interviews: Larry Wall – the creator of Perl
- Big Think: Larry Wall – Why Perl Is Like a Human Language
- Quick Bytes: Python vs Perl
Videos for Programming in Perl
- Twit Coding 101 – Perl – Getting Started
- Twit Coding 101 – Perl RegEx Search and Replace
- Edureka! – Perl Tutorial for Beginners
- Learn Perl 5 By Doing It – Udemy
- Fundamentals of Perl Programming – Alison.com
- Perl Video Courses & Training – Lynda.com
- Perl Fundamentals Course – Virtual Training Company
Tutorials & Online Reading Resources
- Learning Perl at Perl.org
- Learn Perl in about 2 hours 30 minutes – qntm.org
- Perl Beginners Site Online Tutorials
- MIT Perl Class Materials
Forums & Communities
The best books can be found up to date on the Perl.org books page, where books are listed and links to multiple publishers are provided. Perhaps the most used book comes from the O’Reilly series, the 6th edition can be found here.
Where to go from here?
Choosing to learn and use Perl is a skill that very much depends on the use case for which it is needed. It generally will not be the only language you use, but something that gets occasionally pulled out to tackle special problems in text management or security. Perl’s rise and fall in the web development industry was due to the fact that it was created before the web even existed, and the fact that it worked so well for early web development is rather miraculous.
It’s an amazingly robust tool that all programmers in Unix or Linux should be aware of. It will continue to be a valuable for its original intended purpose of better shell scripting, data fine-tuning, and text manipulation.