How can I start an interactive console for Perl?

前端 未结 23 2359
故里飘歌
故里飘歌 2020-12-07 07:37

How can I start an interactive console for Perl, similar to the irb command for Ruby or python for Python?

23条回答
  •  遥遥无期
    2020-12-07 07:53

    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.

提交回复
热议问题