[comp.lang.perl] Bug in pl28 on regexp test?

schmid@spica.cbmvax (Bob Schmid) (09/18/90)

I may have uncovered a bug in perl pl28 that did not exist in perl
pl18 for the same test case, so I have gone back to pl18.

The problem seems to be caused by perl thinking 

($Flds[0] =~ /^[0-9]+$/) 

is 1, even though $Flds[0] does not contain any numeric characters (is
null, actually).  The code fragment that does the regexp test is:

    elsif (($netsection == 1) && ($Flds[0] =~ /^[0-9]+$/))
    {
        print $whatever;
    }

A sample db session is as follows for pl28. Again, the code works
correctly for pl18, but not pl28.


>  Loading custom DB from perldb.pl 3.0.1.3 90/08/09
>  
>  Enter h for help.
>  
>  ................
>  ..other stuff...
>  ................
>  
>    DB<2> p $Flds[0]
>  
>    DB<3> p ">$Flds[0]<"
>  p ">$Flds[0]<"
>  ><
>    DB<4> p ($Flds[0] =~ /^[0-9]+$/)
>  1
>    DB<5> 


Thanks,

-Bob


------------------------------------------------------
R. Schmid     <uunet!cbmvax!schmid>
              <schmid@cbmvax.cbm.commodore.com>

tel#  215-431-9100 x9885
fax#  215-431-9156

VLSI Design
Commodore Technology
1200 Wilson Drive
West Chester, PA  19380
------------------------------------------------------

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (09/18/90)

In article <14496@cbmvax.commodore.com> schmid@spica.cbmvax (Bob Schmid) writes:
: I may have uncovered a bug in perl pl28 that did not exist in perl
: pl18 for the same test case, so I have gone back to pl18.
: 
: The problem seems to be caused by perl thinking 
: 
: ($Flds[0] =~ /^[0-9]+$/) 
: 
: is 1, even though $Flds[0] does not contain any numeric characters (is
: null, actually).

This is already fixed in my copy, so the next patch will have the fix.
Don't expect it for a while though--between my real work and The Book
(and sick kids), I've been totally swamped.

Larry