Lucas Rey has asked for the wisdom of the Perl Monks concerning the following question:

Dear monkers, I need a permanent prompt to listen for user commands. The code I'm currently using is the following:
sub promptUser { local($promptString,$defaultValue) = @_; print $promptString; $| = 1; $_ = <STDIN>; chomp; return $_; } while (1) { $command = &promptUser("ABC> "); }

The above code works perfect, and store what user write into $command variable. The problem is that in this prompt, Backspace and arrows doesn't work. I got something like: ^H^[[A^[[B . So for delete chars I have to use canc, but I cannot use arrows to move into what I wrote or UP and DOWN to surf into history like bash already do. Is there a way to use backspace and/or arrows without external module? (I'm in a server offline)
Thank you Lucas

Replies are listed 'Best First'.
Re: Permanent prompt waiting for user command
by haukex (Archbishop) on Dec 03, 2022 at 07:30 UTC
      Hi, no problem with "use Term::ReadLine;", thank you. Do you have any example code?
        Do you have any example code?

        I thought the Synopsis in the documentation would be enough - you did click the link, right? If you are having trouble with the module, please post the code you're having problems with. See SSCCE and How do I post a question effectively?