[OT] Perl woes

Jonathan Stowe jns at integration-house.com
Wed Jan 28 11:23:54 GMT 2009

2009/1/28 Jonathan Kimmitt <Jonathan.Kimmitt at csr.com>:
>        Whoever said, the primary purpose of a compiler is to check for
> errors,
>        and only if there are no errors, create the code, was most
> definitely not talking about Perl.
>        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)
>        It would be a trivial matter to return an error or warning if ==
> is used for items which aren't numbers

It is trivial indeed.

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

You do realize that you have to ask perl to give you the warning?

[stowej01 at ioz-dev-mobile ~]$ perl -w -e'if ( "a" == "b" ) { print "bar" }'
Argument "b" isn't numeric in numeric eq (==) at -e line 1.
Argument "a" isn't numeric in numeric eq (==) at -e line 1.

The key here is the '-w' on the command line.  You would have 'use
warnings;' in your program file for general use.

http://rabidgravy.com/ - Music
http://gellyfish.co.uk/ - Everything else

More information about the london.pm mailing list