How can I start an interactive console for Perl?

前端 未结 23 2440
故里飘歌
故里飘歌 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:44

    I use the command line as a console:

    $ perl -e 'print "JAPH\n"'
    

    Then I can use my bash history to get back old commands. This does not preserve state, however.

    This form is most useful when you want to test "one little thing" (like when answering Perl questions). Often, I find these commands get scraped verbatim into a shell script or makefile.

提交回复
热议问题