views:

223

answers:

4

What is an easy way to provide a string value to my user and let the user edit it... without him having to retype the whole string if it's not 100% correct.

+7  A: 

Though it's difficult to tell for sure what you're asking for, you probably want Term::ReadLine.

Sorpigal
And if you have GNU Readline available, don't forget to install Term::ReadLine::Gnu (then Term::ReadLine will use it instead).
oylenshpeegul
If you use Term::ReadLine::Gnu and you distribute your program, you need to distribute your program under the terms of the GPL.
jrockway
Nonsense. One required to do so when distributing libreadline, but hardly anyone does that. Instead people merely point to Term::ReadLine::Gnu (which is under the usual dual licence) in their distribution meta file, thus may pick something something different.
daxim
+3  A: 

See Term::Prompt or Prompt::ReadKey.

Sinan Ünür
+3  A: 

Or for something a bit higher level, perhaps IO::Prompt

Adam Kennedy
+1  A: 

Or if you have Perl 5.10.0 or higher, try Damian Conway's IO::Prompter (the successor to IO::Prompt). I wish I could use it for its timeout feature, but alas I'm stuck on Perl 5.8.8.

molecules