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

I need to do some data input (eg. from <STDIN>) Can i do such thing like this :

Input : <please enter your name here>

I want to print the default (string in bold), and then let user edit the string. thanx in advance :)

Replies are listed 'Best First'.
Re: PROMPT wih default
by idsfa (Vicar) on May 27, 2004 at 06:15 UTC

    Well, if you have Term::Readline, you can

    use Term::ReadLine; $term = new Term::ReadLine 'ProgramName'; $_ = $term->readline('prompt>','<please enter your name here>');

    I recommend Term::Readline::Zoid or Term::Readline::Gnu as good back-end implementations. As for the bold-facing, well, choose your preput string very carefully ... and be certain your terminal can display bold text.


    If anyone needs me I'll be in the Angry Dome.
      Ok, it works. thanx
      But how can i customize the output? e.g disable the 'underline'/'bold' mode?
Re: PROMPT wih default
by witandhumor (Pilgrim) on May 27, 2004 at 06:11 UTC
    Can you show us what you have tried so far?