问题
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.
回答1:
Though it's difficult to tell for sure what you're asking for, you probably want Term::ReadLine.
回答2:
See Term::Prompt or Prompt::ReadKey.
回答3:
Or for something a bit higher level, perhaps IO::Prompt
回答4:
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.
来源:https://stackoverflow.com/questions/2374147/interactive-prompt-in-perl