Lähettäjä: Wakko Warner Päiväys: Vastaanottaja: Dave Evans Kopio: exim-users Aihe: Re: [exim] More integer annoyances in 4.65
Dave Evans wrote: > On Wed, Jan 03, 2007 at 12:45:50PM -0500, Wakko Warner wrote:
> > # perl -e 'print "Its 0\n" if "" == 0'
> > Its 0
>
> But as every Perl user knows, always "use warnings" or "-w":
I'm actually not in the habit of that =) I don't often do any scripting
though.
> davide@ratty:~$ perl -we '1==""'
> Argument "" isn't numeric in numeric eq (==) at -e line 1.
> davide@ratty:~$
# perl -we 'print "Its 0\n" if ""=="0"'
Argument "" isn't numeric in numeric eq (==) at -e line 1.
Its 0
#
> It sounds like treating "" as 0, but also emitting a warning (to where? - the
> main log presumably) is probably a good compromise.
Yes, the one above, I'm giving it 2 strings and doing integer testing on it.
Yes, it's a warning and it does work. I'm sure "" eq "0" would be false.
--
Lab tests show that use of micro$oft causes cancer in lab animals
Got Gas???