Perl tutorial
Explore practical text processing and scripting.
Course contents
Programming fundamentals
Perl Basics
Declare a scalar and print it.
Perl Subroutines
Define a sub that reads its arguments from @_.
Perl regular expressions and text processing
Capture named groups, collect all matches, transliterate characters, and compute replacements with /e.
Perl references and nested data structures
Build hashes of arrays, add to them, and loop over them with references.
Perl file handles on strings and formatted output
Read lines from a string as if from a file, validate each line, and write formatted output to a string.
Perl subroutines, context, and closures
Return different results in list and scalar context, build closures, and write a recursive anonymous function.
Object-oriented programming
Data structures and algorithms
Perl Arrays
Store a list in an @array and loop over it.
Perl Hashes
Map keys to values and print them in a stable order.
Perl sort blocks and the Schwartzian transform
Sort numbers, hash keys by value, and records by computed keys without recomputing the keys.
Perl stacks, queues, and word frequencies
Use push, pop, shift, and unshift as stack and queue operations, and count items with a hash.