Est. 2015 Intermediate

Raku

A powerful, expressive programming language from the Perl family, designed for elegance and concurrency with gradual typing and extensive Unicode support.

Created by Larry Wall and the Raku community

Paradigm Multi-paradigm: Object-Oriented, Functional, Procedural, Concurrent
Typing Gradual (Dynamic with optional Static)
First Appeared 2015
Latest Version Rakudo 2025.12

Raku (formerly known as Perl 6) is a member of the Perl family of programming languages that took a bold step: rather than incrementally evolving Perl 5, the community designed a completely new language from first principles while keeping the spirit of Perl. The result is one of the most feature-rich and expressive languages ever created.

History & Origins

In 2000, at the Perl Conference, Larry Wall announced that Perl 6 would be a complete redesign rather than an incremental update. The community threw out everything and started fresh, incorporating lessons learned from Perl 5 and ideas from languages like Haskell, Ruby, and Smalltalk.

The development took 15 years—far longer than anyone expected. During this time:

  • 2004: Audrey Tang created Pugs, the first working implementation in Haskell
  • 2010: Rakudo Star emerged as the primary implementation on the MoarVM virtual machine
  • 2015: Version 6.c (Christmas) was officially released
  • 2019: Renamed to “Raku” (using the ~ sigil as its logo) to clarify it’s a sister language, not a replacement for Perl 5

The Name “Raku”

“Raku” comes from the Japanese word 楽 meaning “ease” or “comfort”, reflecting the language’s goal of programmer happiness. It also references “Rakudo” (the main compiler) and maintains a connection to Perl through shared etymology.

Key Features

Gradual Typing

Raku lets you choose your typing discipline—fully dynamic, fully static, or anywhere in between:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Dynamic - no type constraints
my $name = "World";

# Gradual - optional type annotations
my Str $greeting = "Hello";
my Int $count = 42;

# Constrained with subsets
subset PositiveInt of Int where * > 0;
my PositiveInt $age = 25;

Powerful Grammars

Raku elevates regular expressions to a complete parsing system called grammars:

1
2
3
4
5
6
7
8
9
grammar Email {
    token TOP { <local> '@' <domain> }
    token local { <[\w.+-]>+ }
    token domain { <[\w.-]>+ '.' <alpha> ** 2..* }
}

if Email.parse("user@example.com") {
    say "Valid email!";
}

Grammars can parse anything from simple patterns to complete programming languages.

Unicode-First Design

Raku has comprehensive Unicode support built into the language core:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Unicode operators work naturally
my $sum = 1 + 2 + 3;  # Or use ∑
say (1, 2, 3).sum;    # → 6

# Unicode in identifiers
my= 3.14159;
my $人名 = "Name";

# Set operations with Unicode
my $evens = (2, 4, 6).Set;
my $primes = (2, 3, 5, 7).Set;
say $evens  $primes;  # → Set(2)

Built-in Concurrency

Raku has native support for concurrent and parallel programming:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Promises (like JavaScript promises)
my $promise = start {
    sleep 1;
    "Result"
}
say await $promise;

# Parallel processing
my @results = (1..100).hyper.map: { expensive-calculation($_) };

# Channels for communication
my $channel = Channel.new;
start { $channel.send($_) for 1..10 }
say $channel.receive for ^10;

Junctions (Quantum Superpositions)

One of Raku’s most unique features—values that are multiple things at once:

1
2
3
4
5
6
7
my $x = 1 | 2 | 3;     # any junction
say $x == 2;           # True (one of them is 2)

my $password = "secret";
if $password eq "secret" | "admin" | "password123" {
    say "Weak password!";
}

Raku vs. Perl 5

FeaturePerl 5Raku
Release19942015
TypingDynamic onlyGradual
ObjectsBolted onNative, with roles
ConcurrencyThreads/modulesBuilt-in promises, channels
RegexPowerfulGrammars (even more powerful)
UnicodePartialFirst-class everywhere
SigilsType-basedContainer-based
CompatibilityBackward compatibleNew language

The Sigil System

Raku’s sigils indicate the container type, not the value type:

1
2
3
4
5
6
7
8
my $scalar = "one thing";     # Scalar (single value)
my @array = 1, 2, 3;          # Array (ordered list)
my %hash = :key<value>;       # Hash (key-value pairs)
my &func = { $_ * 2 };        # Callable (function)

# Sigils are invariant (unlike Perl 5)
say @array[0];    # Still @, not $ like in Perl 5
say %hash<key>;   # Still %, not $ like in Perl 5

Object-Oriented Programming

Raku has a sophisticated built-in object system:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
class Person {
    has Str $.name is required;
    has Int $.age = 0;

    method greet(--> Str) {
        "Hello, I'm $!name"
    }
}

# Roles (like interfaces with implementation)
role Swimmer {
    method swim { say "Swimming!" }
}

class Athlete is Person does Swimmer {
    has Str $.sport;
}

my $athlete = Athlete.new(:name<Michael>, :sport<Swimming>);
$athlete.swim;  # Swimming!

Why Raku Today?

Raku excels in specific domains:

  1. Text Processing: Grammars are the most powerful parsing tool in any mainstream language
  2. Prototyping: Try ideas quickly with gradual typing
  3. Concurrency: Built-in async primitives simplify parallel code
  4. Language Experimentation: Explore advanced programming concepts
  5. Unicode-Heavy Tasks: First-class support for international text

Trade-offs

  • Startup time can be slow compared to interpreted languages
  • Smaller ecosystem than Perl 5’s CPAN (though growing)
  • Learning curve is steep due to rich feature set
  • Fewer jobs specifically requiring Raku

The Perl Family Today

Perl 5 and Raku coexist as sister languages:

  • Perl 5: Mature, stable, huge ecosystem (CPAN), excellent for system administration and text processing
  • Raku: Modern design, powerful features, growing ecosystem, excellent for parsing and concurrent programming

Both are actively developed, and skills transfer between them.

Getting Started

Raku is available through:

  • Rakudo Star: The recommended distribution including popular modules
  • Docker: Official rakudo-star image for containerized development
  • Package managers: Available on most Linux distributions

The community is welcoming, and resources include:

Raku represents one of the most ambitious language design efforts in programming history. Whether or not it becomes widely adopted, it has pushed the boundaries of what programming languages can do.

Timeline

2000
Perl 6 announced by Larry Wall at the Perl Conference as a complete redesign of Perl
2004
Pugs interpreter written in Haskell becomes the first working Perl 6 implementation
2010
Rakudo Star released as the first usable Perl 6 distribution with the MoarVM backend
2015
Perl 6 version 6.c (Christmas) officially released after 15 years of development
2019
Perl 6 renamed to Raku to clarify it is a separate language from Perl 5
2020
Raku 6.d (Diwali) released with significant improvements and stabilization
2024
Rakudo continues monthly releases with performance improvements and new features

Notable Uses & Legacy

Text Processing

Raku's powerful grammars make it exceptional for parsing complex text formats and DSLs.

Concurrent Programming

Built-in promises, channels, and supplies enable elegant reactive and parallel programming.

Prototyping

Gradual typing and flexible syntax make Raku ideal for rapid prototyping and exploration.

Educational

Used in programming language courses to demonstrate advanced language features and design.

Bioinformatics

BioRaku provides modules for biological sequence analysis, continuing Perl's genomics legacy.

Language Influence

Influenced By

Perl Haskell Ruby Smalltalk JavaScript

Influenced

Programming language research Perl 5 features backported

Running Today

Run examples using the official Docker image:

docker pull rakudo-star:alpine

Example usage:

docker run --rm -v $(pwd):/app -w /app rakudo-star:alpine raku hello.raku

Topics Covered

Last updated: