prompt; while( ) { chomp; last if /^[a-d]$/i; prompt; } sub prompt { print "\nPick a letter between a and d.\n"; }