>>>>> "OC" == Owen Chavez <owen.chavez314...@gmail.com> writes:
OC> while () { OC> if ($input = 'this') { OC> # Do some things. OC> last; OC> } OC> elsif ($input = 'that') { OC> # Do some other things. OC> last; OC> } OC> else { OC> print "The original directions again.\n"; OC> chomp ($input = <STDIN>); OC> } OC> Keeping the conditional statement empty and using last gets the OC> job done, although I know it's not right (even if it is OC> effective). Can someone nudge me in the right direction? why do you think it is wrong? that is a common way to control loops. i would make it a little simpler by removing the else's. since you do flow control in the if's, when they fail they will just fall through to the next statement. and the last else block can be removed and its code becomes main line level. while () { if ($input = 'this') { # Do some things. last; } if ($input = 'that') { # Do some other things. last; } print "The original directions again.\n"; chomp ($input = <STDIN>); } but if you have more than 3 or so possible input keys, use a dispatch table. you can google usenet or this list for many posts on dispatch tables. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/