Re: Testing a scalier for two possible values at once
Adam Jimerson wrote: I need to test a scalier to see if its value is not two possibilities, because this test is being done inside a while loop I can not use an elsif statement without things getting ugly. I have tried it like this if ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax error when I tried to run it. That should be: if ( $scalier ne 'A' && $scalier ne 'B' ) { John -- Those people who think they know everything are a great annoyance to those of us who do.-- Isaac Asimov -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a scalier for two possible values at once
On Wed, May 13, 2009 at 11:25:40AM +0200, Alexander Koenig wrote: > You wrote on 05/13/2009 02:17 AM: > > I need to test a scalier to see if its value is not two possibilities, > > because this test is being done inside a while loop I can not use an elsif > > statement without things getting ugly. I have tried it like this if > > ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax > > error when I tried to run it. > > It's ne not nq. You'll also need to get your logic correct or you might find that reducing to if (1) {} -- Paul Johnson - p...@pjcj.net http://www.pjcj.net -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a scalier for two possible values at once
You wrote on 05/13/2009 02:17 AM: > I need to test a scalier to see if its value is not two possibilities, > because this test is being done inside a while loop I can not use an elsif > statement without things getting ugly. I have tried it like this if > ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax > error when I tried to run it. It's ne not nq. hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Testing a scalier for two possible values at once
I need to test a scalier to see if its value is not two possibilities, because this test is being done inside a while loop I can not use an elsif statement without things getting ugly. I have tried it like this if ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax error when I tried to run it. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/