in reply to Re: Re: Re: pushing individual rows of return (DBI) into seperate arrays
in thread pushing individual rows of return (DBI) into seperate arrays

Maybe I haven't been reading closely enough, but I've never seen that before. I must say that I find that counter-intuitive, as you did initially. I don't see the need for additional code that exists only to validate earlier code where you want to guard against making a coding mistake - does that make sense? Just bite the bullet and learn that "==" is to compare numbers. peppiv did the right thing posting his question here - someone will see the error, even if you can't ;-)
  • Comment on Re: Re: Re: Re: pushing individual rows of return (DBI) into seperate arrays

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: pushing individual rows of return (DBI) into seperate arrays
by menolly (Hermit) on Aug 28, 2003 at 21:34 UTC
    It's not additional code. It's using
    if (1 == $x) { ... }
    instead of
    if ($x == 1) { ... }
    because
    if (1 = $x) { ... }
    is a syntax error, but
    if ($x = 1) { ... }
    is not.
Re: Re: Re: Re: Re: pushing individual rows of return (DBI) into seperate arrays
by bean (Monk) on Aug 29, 2003 at 01:45 UTC
    It's easy enough to learn that "==" is to compare numbers, "eq" is to compare strings, and "=" is for assignment in Perl, but peppiv is using Perl and SQL at the same time, and in SQL "=" is for all exact comparison and ":=" is for assignment. I (fortunately) tend to confuse the two to the detriment of my SQL, which almost always causes a syntax error instead of a logical error. Syntax errors are easier to fix than logical ones - I like "1 == $x" style for that reason (although I never remember to do it).