Perl quick reference

Runs in Zerethon IDE · Perl 5.40 Official Perl documentation ↗

Perl 5.40 essentials: scalars, arrays and hashes, control flow, subroutines with signatures, references, strings and regular expressions, input and files — and how a Perl program runs in Zerethon IDE.

Written for Perl 5.40. Examples that show an output were run in the Zerethon sandbox (Perl 5.40) on 2026-10-24.

Basics

  • Hello, World

    The smallest Perl program, use v5.40, and printing with say and print.

  • Scalars, arrays and hashes

    The three kinds of variable — $scalar, @array, %hash — my, undef, and numbers vs strings.

  • Conditions and loops

    if / elsif / unless, for over a list or range, while, statement modifiers, and next / last.

  • Subroutines

    Define subroutines with sub and signatures, default arguments, returning lists, the older @_ style, and anonymous subs.

Data

Input and files

In Zerethon IDE

  • Running Perl in Zerethon IDE

    What Run does with your project, the time limit, input, tests, and what a run cannot do.

  • Common errors

    What Global symbol requires explicit package name, Use of uninitialized value, isn't numeric, Can't locate and strict refs mean and how to fix them.

  • Official documentation

    Where to read more: perlintro, the function and operator references, the regex tutorial and perldiag.

References