Top 1,000 Features Creators Events Podcasts Extensions Interviews Blog Explorer CSV

Perl

< >

Perl is an open source programming language created in 1987 by Larry Wall.

#8on PLDB 37Years Old 170kRepos
Download source code:
git clone https://github.com/Perl/perl5
Homepage · Leet Sheet · REPL · Try It Online · Download · Source Code · Spec · Wikipedia · Subreddit · FAQ · Release Notes · Docs · Mailing List

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...


Example from Riju:
print("Hello, world!\n");
Example from hello-world:
#!/usr/bin/perl print "Hello World\n";
# Hello world in perl print "Hello World!\n";
Example from Linguist:
#!/usr/local/bin/perl print "Perl\n"
Example 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";
__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
Standard Library
print "Hello, World!\n";
Scientific Notation
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;
Here Document
Line Comments
# A comment
#
MultiLine Comments
=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
=begin =cut
Comments
# A comment
Regular Expression Syntax Sugar
print "Hello World" =~ /(\w)/;
Strings
"hello world"
Case Insensitive Identifiers X
Semantic Indentation X

View source

- Build the next great programming language · About · Resources · Acknowledgements · Part of the World Wide Scroll