boom has asked for the wisdom of the Perl Monks concerning the following question:
I have the following piece of code in my program:
$val = chr(someFunction()); if($val == " ") { #do something } elsif($val == 0) { #do something else }
But whenever 0 is passed to $val, the if part executes instead of the elsif which I expect to get executed. How can I fix this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I differentiate between 0 and whitespace in Perl?
by syphilis (Archbishop) on Apr 18, 2009 at 14:04 UTC | |
|
Re: How can I differentiate between 0 and whitespace in Perl?
by Anonymous Monk on Apr 18, 2009 at 13:51 UTC | |
|
Re: How can I differentiate between 0 and whitespace in Perl?
by codeacrobat (Chaplain) on Apr 19, 2009 at 10:05 UTC | |
by almut (Canon) on Apr 19, 2009 at 11:40 UTC | |
by codeacrobat (Chaplain) on Apr 19, 2009 at 14:40 UTC | |
by Anonymous Monk on Apr 19, 2009 at 12:43 UTC | |
by almut (Canon) on Apr 19, 2009 at 13:02 UTC |