如何启动Perl的交互式控制台,类似于Ruby的irb命令或python的python命令?


当前回答

你可以在网上做这件事(就像生活中的许多事情一样):

https://www.tutorialspoint.com/execute_perl_online.php

其他回答

Perl -d是你的朋友:

% perl -de 0

Sepia和PDE也有自己的reps(用于GNU Emacs)。

在 Debian/Ubuntu 下:

$ sudo apt-get install libdevel-repl-perl
$ re.pl

$ sudo apt-get install libapp-repl-perl
$ iperl

您可以直接进入内置调试器并从那里运行命令。

   perl -d -e 1

如果需要历史记录,请使用rlwrap。这可以是你的~/bin/ips,例如:

#!/bin/sh
echo 'This is Interactive Perl shell'
rlwrap -A -pgreen -S"perl> " perl -wnE'say eval()//$@'

这是它的样子:

$ ips
This is Interactive Perl shell
perl> 2**128
3.40282366920938e+38
perl>