sub_chick has asked for the wisdom of the Perl Monks concerning the following question:
In this block, I really wanted to do something like:while () { print "Are you having/had a good, bad, or iffy day $name?: "; chomp ($input = <STDIN>); if ($input eq 'good') { print "Glad you are doing well!\n";last;} elsif ($input eq 'bad') { print "Oi, that's not good to hear!\n";last;} elsif ($input eq 'iffy') { print "At least you're undecided...still hope after all.\n +";last;} } print "\n";
and get rid of all the {last;} at the end of each elsif statement. The problem is that I can't seem to get this or operator to work properlly and I was hoping someone could possibly point me in the right direction.elsif ($input ne 'good'|| 'bad'|| 'iffy') { next;}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A better understanding of while () loops
by xdg (Monsignor) on Dec 01, 2005 at 16:33 UTC | |
by sub_chick (Hermit) on Dec 01, 2005 at 17:04 UTC | |
|
Re: A better understanding of while () loops
by wfsp (Abbot) on Dec 01, 2005 at 16:38 UTC | |
|
Re: A better understanding of while () loops
by fishbot_v2 (Chaplain) on Dec 01, 2005 at 16:42 UTC | |
|
Re: A better understanding of while () loops
by Perl Mouse (Chaplain) on Dec 01, 2005 at 16:52 UTC | |
|
Re: A better understanding of while () loops
by sub_chick (Hermit) on Dec 01, 2005 at 17:02 UTC | |
|
Re: A better understanding of while () loops
by psychotic (Beadle) on Dec 01, 2005 at 16:40 UTC |