The REPL is an interactive Raku prompt. Each line of code you enter in the REPL is executed, and if no output was generated, the value returned by the expression is output.


Note: Running code in the REPL is not equivalent to saving the code in a file and running that. Each line introduces a new scope which can confuse code that has multiple lines. See sub repl() below for a way to target a REPL inside a larger script.

non-interactive mode§

If invoked from the command line with raku --repl-mode=non-interactive, no history or prompts are printed, and the code is not executed until you close input (on Linux, for example, you can pipe the code to it or press Control-d.

    $ echo "say 3" | raku --repl-mode=non-interactive

sub repl()§

This routine allows you to embed a REPL inside a larger script and have access to all the variables in context.

See sub repl() in Independent Routines for more information.


See ENVIRONMENT Variables.

Get command line history§

In a fresh install, there is no command history. Running the REPL in this mode will prompt you to install one of the various modules that provide this support. If enabled, you can use the arrow keys to scroll through previous commands and use standard terminal shortcuts for editing. There are currently four options:

  • 1

    zef install Terminal::LineEditor

  • 2

    zef install Linenoise

This requires a working C toolchain.

  • 3

    zef install Readline

This requires an installation of the Readline development library.

  • 4

An alternative for UNIX-like systems is to install rlwrap. This can be done on Debian-ish systems by running:

sudo apt-get install rlwrap

And then use it to invoke the REPL:

rlwrap raku