in reply to If condition logic yielding partially correct output

perlpal has asked for the wisdom of the Perl Monks concerning the following question:

Hi PerlMonks, Seeking you assistance for the following :

First some wisdom, Use strict warnings and diagnostics or die,

Now to your code, oops, more wisdom :) read perlnumber

warn 'test' ne 0; warn 'test' == 0; warn 'test' != 0; warn 'test' + 0; __END__ 1 at - line 1. 1 at - line 2. Warning: something's wrong at - line 3. 0 at - line 4.
A string, used in numeric operation, is converted to a number, most often 0. You want to use ne. See also defined and length.