How can I start an interactive console for Perl, similar to the irb
command for Ruby or python
for Python?
I've created perli, a Perl REPL that runs on Linux, macOS, and Windows.
Its focus is automatic result printing, convenient documentation lookups, and easy
inspection of regular-expression matches.
You can see screenshots here.
It works stand-alone (has no dependencies other than Perl itself), but installation of rlwrap is strongly recommended so as to support command-line editing, persistent command history, and tab-completion - read more here.
Installation
If you happen to have Node.js installed:
npm install -g perli
Otherwise:
Unix-like platforms: Download this script as perli
to a folder in your system's path and make it executable with chmod +x
.
Windows: Download the this script as perli.pl
(note the .pl
extension) to a folder in your system's path.
If you don't mind invoking Perli as perli.pl
, you're all set.
Otherwise, create a batch file named perli.cmd
in the same folder with the following content: @%~dpn.pl %*
; this enables invocation as just perli
.