in reply to Re: Re: Re: creating an array of names
in thread creating an array of names

Using = when you mean == or eq can be very confusing.
Which is why it is a good idea to put the the constant on left-hand side of a numerical comparison
0 == $foo; # GOOD 0 = $foo; # BAD __output__ Can't modify constant item in scalar assignment at - line 2, near "$fo +o;" Execution of - aborted due to compilation errors.
So we get a nice compile-time error if we ever slip up with our numerical comparisons, hurrah!
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: creating an array of names
by tachyon (Chancellor) on Nov 11, 2002 at 19:31 UTC

    Cute, don't know if I could ever get into the habit but cute nonethless.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Re: Re: Re: Re: creating an array of names
by John M. Dlugosz (Monsignor) on Nov 11, 2002 at 19:43 UTC
    I also exagerate the visible difference by writing assignment with asymetric spacing and equality with symetric spacing.
    $a= 5; if ($a==$b || $c == $d)
Re: Re: Re: Re: Re: creating an array of names
by sauoq (Abbot) on Nov 11, 2002 at 21:39 UTC

    Although I'm familiar with this practice I really don't care for it much. Admittedly, it's just a personal preference. I don't think it flows as well when reading it though. More importantly, there simply is no substitute for learning to be cautious. This trick works nicely when one of the operands is a constant but not at all when they are both variables.

    -sauoq
    "My two cents aren't worth a dime.";