On Tue, 14 Dec 2004, Christopher Spears wrote: > I'm writing a Perl script where I ask the user a > question similar to: > > Would you like to remove this file? > Type y or n.
Try Damian Conway's IO::Prompt: <http://search.cpan.org/~autrijus/IO-Prompt-0.02/lib/IO/Prompt.pm> Use it like this: use IO::Prompt; while( prompt "next: " ) { print "You said '$_'\n"; } Or maybe in your case like this: $user_input = prompt( qq[Would you like to remove this file?\nType y or n. ], -tty, -yes, -no, -onechar, -speed=>0.2 ); You can write this by hand, but once Damian has attacked a problem, there's little point in trying to out-clever him :-) -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>