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 07:17
Subject:
Re: [perl #76756] PATCH: srand returns the seed
Message ID:
AANLkTimS3RYr4ukbU86RLO3vgT3w7b76eBy1UceXPXXf@mail.gmail.com
On Wed, Jul 28, 2010 at 10:07, karl williamson <public@khwilliamson.com> wrote:
> Nicholas Clark wrote:
>>
>> On Wed, Jul 28, 2010 at 04:48:52AM -0400, Chas. Owens wrote:
>>>
>>> On Tue, Jul 27, 2010 at 12:23, karl williamson
>>> <perlbug-followup@perl.org> wrote:
>>>>
>>>> # New Ticket Created by  karl williamson
>>>> # Please include the string:  [perl #76756]
>>>> # in the subject line of all future correspondence about this issue.
>>>> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=76756 >
>>>>
>>>>
>>>> Attached
>>>>
>>> If the seed can every be 0, then this breaks the following very important
>>> code:
>>
>>> I guess it is time to print up new business cards.
>>
>> No need:
>>
>> commit da1010ecc50c91387eed9bcc349e6960909a3484
>> Author: Nicholas Clark <nick@ccl4.org>
>> Date:   Wed Jul 28 11:01:51 2010 +0100
>>
>>    Make srand() return "0 but true" for 0, for backwards compatible
>> behaviour.
>>
>>
>> (which I had suggested as part of the original discussion)
>>
>> Nicholas Clark
>>
> But you suggested it in such a way that it went right over my head.  I
> didn't understand what you meant; and thought you were being funny, cause I
> don't have the background to to get it.  I'll have to examine your changes.
>

"0 but true", "0e0", "0.0", and a couple other strings are true values
(because they aren't the string "0"), but don't elicit the 'Argument
"%s" isn't numeric%s' warning.

perl -wE 'say $_ + 1, $_ ? " true" : " false" for qw/ 0 0.0 0e0 /, "0
but true", "0 but dkfjnkerfnk"'

1 false
1 true
1 true
1 true
Argument "0 but dkfjnkerfnk" isn't numeric in addition (+) at -e line 1.
1 true

-- 
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