Installation, Tools and First Program

2.1 Installing Raku

# rakubrew: version manager (recommended)
curl https://rakubrew.org/install-on-perl.sh | sh      # or download the binary from rakubrew.org (Windows too)
rakubrew download            # download the latest prebuilt Rakudo
rakubrew build-zef           # install zef (module manager)
# Rakudo Star bundle (Rakudo + zef + common modules): rakudo.org/downloads
# Linux packages: apt install rakudo (may be older), or the rakudo-pkg repositories
# macOS: brew install rakudo-star
# Docker: docker run -it rakudo-star
raku --version               # e.g. "Welcome to Rakudo™ v2025.xx. Implementing the Raku® Programming Language v6.d."

2.2 Hello, World

File extensions: .raku (scripts), .rakumod (modules), .rakutest (tests), .rakudoc (docs). Old ones (.p6, .pm6, .t, .pod6) still work.

# hello.raku
say "Hello, World!";

my $name = "Raku";
say "Hello, $name!";                 # interpolation
say "Sum: { 2 + 3 }";                # code interpolation with { }
put 'No interpolation: $name';       # put = print + newline (uses .Str)
print "No newline";
note "This goes to STDERR";
raku hello.raku
raku -e 'say 2 ** 100'               # one-liner: 1267650600228229401496703205376
raku                                 # interactive REPL
raku -c hello.raku                   # syntax check
raku -n -e '.say if /error/' log.txt # line-by-line like perl -n
raku -p -e 's:g/foo/bar/' file.txt   # like perl -p

2.3 say vs put vs print

.gist (human-friendly; truncates long lists, shows (Any) for undefined) .gist to STDERR

Rakudo-specific debug dump (.raku representation)

my @a = 1, 2, 3;
say @a;        # [1 2 3]
put @a;        # 1 2 3
dd @a;         # Array @a = [1, 2, 3]
say @a.raku;   # [1, 2, 3] (code-like representation)

2.4 Comments and Syntax Basics

Statements end with ; (optional before a closing }). Identifiers may contain hyphens and apostrophes between letters: my $first-name, sub is-valid, my $don't.

Unicode is allowed in identifiers and operators: my $π = π; say 3 × 4; say 10 ÷ 4;.

# single-line comment
#`( embedded / multi-line comment
    using any bracket pair )
#| declarator documentation for the next declaration (see Pod6, Module 50)
sub greet { }