writing $_ == 1 is dangerous because it is too easy to drop an = and assign rather than compare.
Some like to put constants on the LHS (1 == $_) to avoid that problem.
>perl -e"$_ = 0; die qq{uh oh!\n} if $_ = 1;" uh oh! >perl -e"$_ = 0; die qq{uh oh!\n} if 1 = $_;" Can't modify constant item in scalar assignment at -e line 1, near "$_ +;" Execution of -e aborted due to compilation errors.
In reply to Re^2: Is this bad coding style?
by ikegami
in thread Is this bad coding style?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |