Learn Perl from your first print to a small text-processing project, covering scalars, arrays, hashes, subroutines and strings.
8 lessons, 16 exercises. Runs Perl 5.44.
Not started
Hello, output
Print text with print and say, turn on Perl's safety checks, and add comments.
Values and variables
Store values in scalar variables declared with my, see how Perl treats numbers and strings, and define constants.
Reading input and arithmetic
Read lines from STDIN, strip the line break with chomp, and do arithmetic with Perl's operators.
Making decisions
Choose between paths with if, elsif, else and unless, using Perl's separate number and string comparisons.
Loops
Repeat work with foreach over ranges, C-style for and while loops, read input line by line, and control loops with last and next.
Subroutines
Define subroutines with sub, receive arguments through @_ or signatures, return values, and keep variables local with my.
Arrays and hashes
Keep lists of values in arrays, look things up by key in hashes, and sort, join and loop over both.
Strings and a small project
Slice, search and transform text with Perl's string functions and regular expressions, then build a small grade report program.
Your progress is saved in this browser. Sign in to keep it on every device.