PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Perl

Perl

Perl is a programming language created in 1987 by Larry Wall.

Perl is a family of high-level, general-purpose, interpreted, dynamic programming languages. The languages in this family include Perl 5 and Perl 6. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Read more on Wikipedia...

Try now: Riju Β· TIO

#13on PLDB 35Years Old 492.0kUsers

Example code from Riju:

print("Hello, world!\n");

Example code from hello-world:

#!/usr/bin/perl print "Hello World\n";

Example code from the Hello World Collection:

# Hello world in perl print "Hello World!\n";

Example code from Linguist:

#!/usr/local/bin/perl print "Perl\n"

Example code from Wikipedia:

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

Keywords in Perl

__DATA__ else lock qw __END__ elsif lt qx __FILE__ eq m s __LINE__ exp ne sub __PACKAGE__ for no tr and foreach or unless cmp ge package until continue gt q while CORE if qq xor do le qr y

Language features

Feature Supported Example Token
Binary Literals βœ“
# 0b[01]+(_[01]+)*
Integers βœ“
# \d+(_\d+)*
Floats βœ“
# (?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?
Hexadecimals βœ“
# 0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*
Octals βœ“
# 0_?[0-7]+(_[0-7]+)*
Conditionals βœ“
While Loops βœ“
Print() Debugging βœ“ print
Range Operator βœ“
# https://users.cs.cf.ac.uk/Dave.Marshall/PERL/node38.html
@array = (1..10);
Operator Overloading βœ“
Multiple Inheritance βœ“
File Imports βœ“
use Digest::MD5 'md5_hex';
Directives βœ“
# In Perl, the keyword "use", which imports modules, can also be used to specify directives, such as use strict; or use utf8;
use utf8;
Line Comments βœ“
# A comment
#
MultiLine Comments βœ“ =begin =cut
Comments βœ“
# This is a comment in perl
=begin comment
This is all part of multiline comment.
You can use as many lines as you like
These comments will be ignored by the 
compiler until the next =cut is encountered.
=cut
Partial Application βœ“
sub first-and-last ( $first, $last ) {
   say "Name is $first $last";
}
my &surname-smith = &first-and-last.assuming( *, 'Smith' );
&surname-smith.( 'Joe' ); # OUTPUT: «Name is Joe Smith␀» 
Regular Expression Syntax Sugar βœ“
print "Hello World".match(/\w/)
Strings βœ“
"hello world"
Semantic Indentation Ο΄

Trending Perl repos on GitHub

repo stars description
FlameGraph 8342 Stack trace visualizer
webmin 1077 Powerful and flexible web-based server management control panel
cloc 7923 "cloc counts blank lines comment lines and physical lines of source code in many programming languages."
owasp-modsecurity-crs 1828 OWASP ModSecurity Core Rule Set (CRS) Project (Official Repository)
nikto 3232 Nikto web server scanner

Books about Perl on goodreads

title author year reviews ratings rating
Programming Perl Tom Christiansen 1991 52 2104 4.04
Advanced Perl Programming (Perl Series) Sriram Srinivasan 1997 1 201 3.93
Effective Perl Programming Joseph Hall 1997 10 103 4.22
Perl for Dummies Paul E. Hoffman 1997 5 48 3.42
The Perl CD Bookshelf: Perl in a Nutshell/Programming Perl, 2nd Edition/Perl Cookbook/Advanced Perl Programming/Learning Perl, 2nd Edition/Learning Perl on WIN32 Systems O'Reilly Media Inc. 1999 0 27 4.11
Programming the Perl DBI Tim Bunce 2000 3 77 3.47

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements Β· Email Β· GitHub