[OT] Perl woes

James Laver james.laver at gmail.com
Wed Jan 28 11:25:05 GMT 2009


On Wed, Jan 28, 2009 at 10:56 AM, Jonathan Kimmitt
<Jonathan.Kimmitt at csr.com> wrote:
>        The next time I use == instead of eq to compare two strings, I
> will know to expect it will always
>        evaluate to true. What other language does this (apart from C,
> which would invariably return false)

PHP, which does it in a much more bizarre way (any non-empty string ==
TRUE, any empty string == FALSE)

http://uk3.php.net/manual/en/types.comparisons.php

You have to use === to get any sane sort of comparison.

> It would be a trivial matter to return an error or warning if ==
> is used for items which aren't numbers

It does if you ask it to:

use strict;
use warnings;

> And this is in a language which is praised for its powerful
> string handling !

WFM.

--James


More information about the london.pm mailing list