The more typical method for this sort of thing is that the prompting string shows the default value that would be used if the person just hits 'Enter' as a response -- this is how the CPAN shell works, for instance:
Do you want to do the normal thing? [yes] :
Do you want to do something strange, tedious, and/or risky? [no] :
What you want as your return address? [you@there] :
...
(In each case, none of the displayed text gets erased. This can actually be a nice feature, when someone decides they want to paste the dialog into a bug report or mail message, so the recipient can see what choices were offered as defaults, as well as the non-default answers, if any, that were given.)
It's nice not having to delete stuff first in order to type in the value that you really want. The Term::Readline module suggested above, which you should use anyway, does make it easy -- ^U would clear the input line, for instance, as well as repeated use of the "Delete" key -- but the easiest thing is: type nothing but "Enter" to accept the default, and when you don't want the default, type only the value you want without further ado. | [reply] [d/l] |
| [reply] |
Will IO::Prompt do what you need?
UPDATE: And I woulda got away with it, too, if it hadn't been for Fletch! | [reply] |
The conventional method is to simply show the default in brackets and use that if the response is empty. You could also probably work something bass-ackwards out with
FileHandle::Unget
--
In Bob We Trust, All Others Bring Data.
| [reply] |