[wellylug] Getting user input into a Perl program
Cliff Pratt
enkidu at cliffp.com
Sun Jan 29 11:48:35 NZDT 2006
michael at diaspora.gen.nz wrote:
> Cliff Pratt writes:
>
>>eg, what sort of stuff do I put in the sub 'ask_for_input'? In the case
>>below, it would presumbly do something like ask "Continue (Y/N)?" and
>>parse the response and return a true value if it gets a negative
>>response and would break out of the loop.
>
>
> use IO::Prompt;
> STUFF: while (1) {
> do_stuff();
> last STUFF if prompt "Do more stuff [yn]? " -yesno;
> do_more_stuff();
> }
>
> The IO::Prompt module from Damian Conway et al. is useful in these cases.
>
Thanks Michael. Why the label, though?
Cheers,
Cliff
--
http://barzoomian.blogspot.com
More information about the wellylug
mailing list