Hi gurus,
        In http://www.cpan.org/doc/FMTEYEWTK/is_numeric.html, ( Is it a 
number? ), Tom Christiansen writes:
----------------------------------------------------------------------------------------------
If you do care about getting 0's, then do this: 
    do { 
                 print "Number, please: ";
                 $answer = <STDIN>;
                 if ($answer == 0 && $answer ne '0') {
                     print "Bad number\n";
                 }
    } until $answer;
----------------------------------------------------------------------------------------------

I tried this with ActiveState perl version 5.005_03. I entered 0 and got a 
bad number. After thinking awhile, I chomped the $answer. This works for 
0,
( i.e. No "Bad number message"  and  the loop repeats ). I think we need a 
chomp there ( so instead of '0\n' ne '0', it is '0' ne '0' ). Is it so or 
am I missing something? 
---- Thanks in advance,
Atul

Reply via email to