[grand-rapids-pm-list] Perl Puzzle!

grand-rapids-pm-list at pm.org grand-rapids-pm-list at pm.org
Fri Oct 10 08:12:31 PDT 2008


Or the ever popular true-but-zero value: 0E0

--Jason

On Fri, Oct 10, 2008 at 11:00 AM,  <grand-rapids-pm-list at pm.org> wrote:
> use Test::More tests=>2;
>
> my $str = "-0";
> ok($str>=0);
> ok($str ge 0);
>
>
> --matt
>
> On Fri, Oct 10, 2008 at 7:52 AM, <grand-rapids-pm-list at pm.org> wrote:
>>
>> Here's something that tripped me up that I thought I'd share as a Perl
>> Puzzle...
>>
>> Q1: For what value(s) of $a do the following comparisons return different
>> results?
>>
>> $a >= 0
>> $a ge 0
>>
>> Q2: Ok, it isn't hard to guess. But, why? The answer reveals something
>> unique about Perl that is very important to keep in mind.
>>
>>
>> Feel free to reply to the list. I'll post the answer later today if no one
>> nails it.
>>
>> -Ed
>>
>> _______________________________________________
>> grand-rapids-pm-list mailing list
>> grand-rapids-pm-list at pm.org
>> http://mail.pm.org/mailman/listinfo/grand-rapids-pm-list
>
>
>
> --
> Matthew Heusser,
> Blog: http://xndev.blogspot.com
>
> General, you are listening to a machine.  Do the world a favor and don't act
> like one. -- Dr. Stephen Falken, "War Games", The Movie
>
> _______________________________________________
> grand-rapids-pm-list mailing list
> grand-rapids-pm-list at pm.org
> http://mail.pm.org/mailman/listinfo/grand-rapids-pm-list
>


More information about the grand-rapids-pm-list mailing list