- 01Setting up (what you'll need)
- 02Your first output (print)
- 03Variables (scalar variables, $)
- 04Branching (the if statement)
- 05Repeating (the for loop)
- 06Writing a subroutine (a function)
- 07Repeating (the while loop)
- 08Working with arrays (@)
- 09Working with hashes (%)
- 10Regular expression matching
- 11Substitution with regular expressions (s///)
- 12Working with strings
- 13References
- 14Anonymous subroutines
- 15File input and output, the basics
- 16Modules and use strict / warnings
- 17The ternary operator
- 18Sorting (sort)
- 19Packages and the basics of object orientation
- 20[Project] Build a small inventory system
Your first output (print)
This lesson covers the basics of printing in Perl with print.
print "..."; displays text on the screen. Perl is strong at regular expressions and text handling, and has been used for log analysis and system administration for decades.
The sample code prints a string with the single line print "Hello, Perl!\n";. The \n is the special character for a line break.
A common early stumble is forgetting the semicolon ; at the end of the line. A Perl statement has to end in a semicolon, and leaving it out is an error.
In professional work, Perl is still doing real jobs wherever large volumes of text need processing quickly — analysing log files, running text-transformation batches.
๐งช This site can't compile or run Perl directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ nothing is sent anywhere).
