Appendices: Projects, Interview Questions, Cheat Sheet & Resources

Capstone projects, interview questions, a Perl cheat sheet, Perl for developers coming from other languages, and resources with a study plan.

Appendix A: Capstone Projects

Beginner: Word Counter. Read files with <>, count words with a hash, sort by frequency, print a formatted report, support --top N via Getopt::Long.

Beginner: Contact Manager CLI. Hashes of hashes, JSON file persistence, add/search/delete subcommands, input validation.

Intermediate: Log Analyzer. Parse Apache/Nginx logs with regexes, compute top IPs/URLs/status codes, detect anomalies, output text/CSV/JSON, with tests.

Intermediate: CSV ETL Pipeline. Text::CSV_XS input, cleaning and transformation, loading into SQLite/PostgreSQL via DBI with transactions, and an error report.

Intermediate: Directory Sync / Backup Tool. File::Find, checksums (Digest::SHA), incremental copies, compression, dry-run mode, logging.

Intermediate: OOP Inventory System. Moo classes and roles (or the core class feature), type constraints, persistence layer, Test2 test suite.

Advanced: REST API with Mojolicious. CRUD resources, Mojo::Pg, JWT auth, OpenAPI spec, Minion background jobs, Test::Mojo tests, Docker deployment.

Advanced: Web Scraper / Monitor. Mojo::UserAgent async requests with promises, Mojo::DOM parsing, change detection, email/Slack alerts, scheduling.

Advanced: Parallel Server Fleet Tool. Net::OpenSSH + Parallel::ForkManager, run commands across hosts, aggregate results, timeouts, retries.

Advanced: Mini Language Interpreter. A tokenizer with \G//gc, a recursive-descent parser, an AST evaluator, and a REPL.

Advanced: Bioinformatics Pipeline. Parse FASTA/FASTQ, compute GC content and k-mer frequencies, BioPerl integration, parallelism with MCE.

Open Source: Publish a CPAN Module. Build a distribution with Dist::Zilla or Minilla, with tests, POD, CI, and a PAUSE release.

Appendix B: Interview Questions

What are sigils? What is the difference between $, @, and %?

Explain scalar vs list context, with examples (@arr in each, localtime, reverse).

my vs our vs local vs state?

What values are false in Perl?

== vs eq? <=> vs cmp?

|| vs // vs or? Why does open ... || die misbehave?

What does use strict do? use warnings? use v5.36?

chomp vs chop?

How do you remove duplicates from an array while preserving order?

How do you iterate over a hash in sorted key order? Sorted by value?

What are references? How do you create and dereference them? What is postfix dereferencing?

Explain autovivification and its pitfalls.

How do you pass arrays/hashes to subroutines without flattening?

What is @_, and why is it aliased? What do signatures change?

What is wantarray?

Explain map, grep, and sort with $a/$b. What is the Schwartzian Transform?

Why use three-argument open and lexical filehandles?

How do you read a file all at once? Line by line? What is $/?

What do -n, -p, -i, -l, -a, and -e do?

How does local $_ or local $/ work (dynamic scope)?

Greedy vs non-greedy vs possessive quantifiers?

What do /g, /i, /m, /s, /x, /e, /r do?

What are named captures? Lookahead and lookbehind?

How does \G with /gc work?

What is catastrophic backtracking, and how do you avoid it?

What does tr/// do, and how does it differ from s///?

OOP and Advanced Explain Perl OOP: packages, bless, methods, @ISA, SUPER::.

What is the method resolution order? DFS vs C3?

Moose vs Moo vs the core class feature?

What are roles, and why prefer them over inheritance?

How do AUTOLOAD and DESTROY work? Why check for DESTROY in AUTOLOAD?

What are closures? Give a counter example.

What are typeglobs? How do you install a subroutine dynamically?

How does Perl manage memory? How do you fix circular-reference leaks?

die/eval vs try/catch? What are the pitfalls of $@?

What is taint mode?

How do you safely run external commands and capture output?

How do you prevent SQL injection with DBI?

How do you handle UTF-8 input and output correctly?

How do you test Perl code? What is TAP? What does prove do?

How do you manage dependencies reproducibly (cpanfile, Carton)?

How do you profile a slow Perl script?

How do you run tasks in parallel in Perl?

What is PSGI/Plack, and why does it matter?

Count word frequencies in a file and print the top 10.

Parse a log file and report requests per hour, using a single regex.

Write a sub that flattens an arbitrarily nested array reference.

Implement a dispatch table for a command interpreter.

Write a deep-merge function for two hash references.

Write a Moo class with a lazy attribute and a role.

Write a one-liner that swaps columns 1 and 2 of a tab-separated file.

Validate and untaint an email address and a filename.

Appendix C: Perl Cheat Sheet

use v5.36;                                   # strict, warnings, say, signatures

# ===== Variables =====
my $s = 'str'; my @a = (1, 2, 3); my %h = (k => 'v');
$a[0]; $a[-1]; $#a; scalar @a; @a[0, 1]; $h{k}; @h{qw(a b)}; exists $h{k}; delete $h{k};
my $x = $v // 'default'; $count //= 0; state $n = 0;

# ===== Strings =====
"interp $s @a ${s}x"; 'literal'; q{}; qq{}; qw(a b); <<~EOT; length; uc; lc; index; substr; sprintf;
join(',', @a); split(/,/, $str); $s x 3; $s . $t; reverse; chomp; lc $a eq lc $b;

# ===== Control =====
if (...) { } elsif (...) { } else { }   unless (...) { }   say 'x' if $y;
for my $i (1..10) { }  for my ($k, $v) (%h) { }  while (...) { }  next; last; redo; LABEL:

# ===== Lists =====
map { $_ * 2 } @a; grep { /x/ } @a; sort { $a <=> $b } @a; reverse @a;
push/pop/shift/unshift/splice; use List::Util qw(sum max min first any all uniq reduce);

# ===== Subs =====
sub add($x, $y = 0, @rest) { return $x + $y }
my $f = sub ($n) { $n * 2 }; $f->(3);

# ===== References =====
my $ar = [1, 2]; my $hr = { a => 1 }; my $cr = \&add;
$ar->[0]; $hr->{a}; $cr->(1, 2); @$ar; %$hr; $ar->@*; $hr->%*; ref $ar;

# ===== Regex =====
if ($s =~ /(\d+)/) { say $1 }   my @all = $s =
…
perl -ne 'print if /re/' f   perl -pe 's/a/b/g' f   perl -i.bak -pe '...' f   perl -lane 'print $F[0]' f
perl -c script.pl   perl -d script.pl   perldoc -f func   cpanm Module   prove -lr t/   perltidy -b file   perlcritic file

Appendix D: Perl for Other Developers

my @l = (1, 2); / [1, 2] (ref) my %h = (a => 1); / {a => 1} (ref) re.search(p, s) [[ $s =~ p ]] ${s//a/b} / sed $s =~ s/a/b/g function f($x) sub f($x) { } lambda x: x*2 ->(x) { x*2 } fn($x) => $x*2 sub ($x) { $x*2 } map { } @l / grep { } @l set -e, traps eval/die, try/catch (5.34+) packages + bless, Moo, class (5.38+) 0, '', [], None false only nil/false false 0, '', '0', [] false 0, '', '0', undef false Key gotchas:

Python/Ruby devs: sigils change by access (@array but $array[0]); context matters; numeric vs string operators (== vs eq); arrays flatten into lists (use references for nesting); '0' is false.

Bash devs: Perl is a real programming language with data structures. Use it when shell scripts get complicated, and use one-liners as superpowered sed/awk.

PHP devs: similar $ variables, but @ and % sigils, my declarations, and . concatenation (PHP inherited that from Perl).

Appendix E: Resources and Study Plan

perldoc (perldoc.perl.org): perlintro, perlsyn, perldata, perlop, perlfunc, perlsub, perlref, perlreftut, perldsc, perllol, perlre, perlretut, perlrequick, perlobj, perlootut, perlclass, perlunicode, perlsec, perlipc, perlfaq, perldelta

perl.org, learn.perl.org, MetaCPAN (metacpan.org), The Perl Foundation / Perl & Raku Foundation, the Perl Steering Council notes

*Learning Perl* (the "Llama book", Schwartz, foy, Phoenix): the beginner's classic

*Intermediate Perl* (the "Alpaca book") and *Mastering Perl* (brian d foy)

*Programming Perl* (the "Camel book", Wall, Christiansen, Orwant, foy): the reference *Modern Perl* (chromatic; free online) *Perl Best Practices* (Damian Conway)

*Higher-Order Perl* (Mark Jason Dominus; free online) *Perl Cookbook* (Christiansen and Torkington)

*Mastering Regular Expressions* (Jeffrey Friedl) *Effective Perl Programming* (Hall, McAdams, foy)

The Weekly Challenge (theweeklychallenge.org), Perl Weekly newsletter, PerlMonks (perlmonks.org), r/perl, Stack Overflow [perl], IRC (irc.perl.org: #perl, #mojo, #moose), the Perl Discord, The Perl and Raku Conference (TPRC), London Perl Workshop, German Perl Workshop, Perl.com articles 12-Week Study Plan Setup, scalars, strings, operators

Arrays, hashes, context, control flow, I/O Subroutines, scope, references, data structures

List functions, sorting, files, directories Regex basics and advanced, one-liners

Reports, Unicode, modules, CPAN, errors, pragmas OOP: bless, inheritance, Moo/Moose, core class, roles

Closures, symbol tables, special variables, tie/AUTOLOAD Processes, concurrency, networking, CLI tools

Data formats, DBI, web, HTTP, dates, sysadmin Testing, POD, debugging, performance, security 51–53 + Capstone

XS/FFI, packaging, internals, best practices, project Final tip: Start every script with use v5.36;, master context, references, and regular expressions (they're the heart of Perl), read perldoc often, and practice with one-liners and the Weekly Challenge. Write Perl that's clear first and clever second. Happy hacking! 🐪