develooper Front page | perl.perl5.porters | Postings from July 2010

Re: [perl #76756] PATCH: srand returns the seed

Thread Previous | Thread Next
From:
Chas. Owens
Date:
July 28, 2010 11:11
Subject:
Re: [perl #76756] PATCH: srand returns the seed
Message ID:
AANLkTiniudT-ymeH5cTUn+zAhdNdTZ2QfHOUNftGt0kN@mail.gmail.com
On Wed, Jul 28, 2010 at 11:58, Nicholas Clark <nick@ccl4.org> wrote:
snip
> If you're up for it, I don't think that it's documented anywhere that the
> false value returned by a logical operator is a special case:
>
> $ perl -wle '$a = 0 == 1; print ">$a<"; print $a + 0'
>><
> 0
>
> it is both the empty string, and a numeric zero.
> (That's not a special case in any conversion code. It's a dual value)
snip

Yeah, I missed that when I documented the relational and equality
operators in perlopquick.  I will go back and add that detail to them.

snip
> Also, $! is a dual value, with the string value being the error string, and
> numeric value being the error code. On this system, the error string for 0
> *is* an empty string, hence this is false:
>
> $ perl -wle '$! = 0; print ">$!<"; print $! + 0'
>><
> 0
snip

I think that is fairly well documented in perlvar.

snip
> And if you're really up for it, there's a bug with no obvious fix if your
> system supports negative zero:
>
> $ perl -wle '$a = 0/-1; print $a ? "T" : "F"; print $a; print $a ? "T" : "F";'
> F
> -0
> T
snip

That only happens on one's complement machines right?  Are there any
one's complement machines left?

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About