How can I start an interactive console for Perl?

前端 未结 23 2434
故里飘歌
故里飘歌 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 08:00

    If you want history, use rlwrap. This could be your ~/bin/ips for example:

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

    And this is how it looks like:

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

提交回复
热议问题