in reply to do-while loop

If you are using ActiveState Perl, have a look at the module ActiveState::Menu. It will do exactly (or even more) than you require.
use strict; use ActiveState::Menu qw(prompt); my $answer = prompt( 'Pick a letter between a and d.', 'must_match' => + qr/[abcd]/ ); print "Your answer was $answer\n";

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: do-while loop
by irvson (Sexton) on Nov 03, 2009 at 22:33 UTC

    Thank you all for the help. I will get to work.

    J...