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

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

Thread Previous | Thread Next
From:
Abigail
Date:
July 28, 2010 10:39
Subject:
Re: [perl #76756] PATCH: srand returns the seed
Message ID:
20100728174046.GG3850@almanda
On Wed, Jul 28, 2010 at 04:58:44PM +0100, Nicholas Clark wrote:
> 
> 
> the problem being that the implementation of true/false is
> 
> is there a string value?
>   Y: is it "0" or ""?
> is there a numeric value?
>   Y: is it == 0
> ...


The order of first checking for a string value, and only then for
numeric one has bitten me more than once - using an overloaded object
which has numeric overload:

    use overload '+0' => sub {0};
    say !!bless [];      # 1


    use overload '""' => sub {""};
    say !!bless [];      # empty string


Abigail

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