--- Timothy Kimball <[EMAIL PROTECTED]> wrote:
> Ah, yes, one of the most frustrating bugs in the world:
> :     if ($REFln[1] = "SN") {
> This *assigns* the value "SN" to $REFln[1]. What you want to do is
> *test* it. String comparisons in Perl are done with "eq" (and numeric
> comparisons with "=="). So you want this:
>       if ($REFln eq "SN") {

> You can avoid this by always writing comparisons with the constant
> (if there is one) on the left-hand side:
> 
>       if ("SN" eq $REFln)
> 
> but I rarely see people actually do that.

People rarely do it, btu I *HIGHLY* recommend it.
This way, if you write 
  if ("SN" = $REFln) {
the compiler will shut down and warn you that you can't *do* that, and
you'll probably say "Oh! that should have been ==, or maybe eq...."

It's just cleaner code. =o)


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to