Search code examples
perlconsoleinteractiveread-eval-print-loop

How can I start an interactive console for Perl?


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


Solution

  • You can use the perl debugger on a trivial program, like so:

    perl -de1
    

    This command will start the Perl debugger (-d) on expression 1 (-e1), because the debugger wants something to debug (usually a file containing Perl code). The command could be written as perl -d -e 1 as well.

    Alternatively there's Alexis Sukrieh's Perl Console application, but I haven't used it.