[OT] Perl woes

Mark Blackman mark at blackmans.org
Wed Jan 28 12:15:49 GMT 2009


On 28 Jan 2009, at 12:01, Paul Makepeace wrote:

> On Wed, Jan 28, 2009 at 11:31 AM, Dominic Thoreau
> <dominic.thoreau at googlemail.com> wrote:
>> 2009/1/28 Jonathan Kimmitt <Jonathan.Kimmitt at csr.com>:
>>>
>>>       The next time I use == instead of eq to compare two strings, I
>>> will know to expect it will always
>>>       evaluate to true.
>
> Interesting that everyone's said to "use warnings" but no-one's
> questioned what you're saying. Perl appears to me to DTRT:
>
> $ perl -le 'print "yes" if "a" == "2"'
> $ perl -le 'print "yes" if "a" == "a"'
> yes
> $ perl -le 'print "yes" if "1" == "1"'
> yes
> $ perl -le 'print "yes" if "1" == "0"'
> $ perl -le 'print "yes" if "1" == 1'
> yes
> $
>
> Can you give an example where perl is doing something surprising to  
> you?

perl -le 'print "yes" if "a" == "b"'

Is the kind of case I suspect he's hit.

- Mark



More information about the london.pm mailing list