[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] FNG



Chris Nandor wrote:
> 
> If $w contained the null string (or undef), it would not have printed
> 2**32-1 for ~$_.  But if it contained 0, then it would not have printed
> nothing for $_.  0 clearly is not returned.  The null string clearly was
> not returned.  My best guess is that it is some other kind of null, a null
> number.
> 

Why guess when you can be certain?  :-)
(This requires a debugging build.)

~> cat > tmp.pl
/a/;
~> perl -Dctls tmp.pl

EXECUTING...

    =>  
(tmp.pl:0) enter
Entering block 0, type BLOCK
    =>  
(tmp.pl:0) nextstate
    =>  
(tmp.pl:1) match
    =>  SV_NO  
(tmp.pl:1) leave
Leaving block 0, type BLOCK
~> 


As you can see, the failed match puts the special scalar SV_NO on the
stack.  Presumably, SV_NO comprises an integer value of 0 and a string
value of ''.  This explains the output of Chris's program with regards to
$w.

There is also an SV_YES, which is returned by print.

Ronald

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch