Next | Program Repair Shop | 72 |
Testing against 1 is sometimes simply wrong
For example, perlfunc says that -s tests if "File has nonzero size"
die "File is empty" unless -s $file == 1; # WRONG die "File is empty" unless -s $file; # right
It's always silly
if (($foo == 12) == 1) { ... }
Why not this?
if ((($foo == 12) == 1) == 1) { ... }
Or this?
if (((($foo == 12) == 1) == 1) != 0) { ... }
Distinguish between booleans and numbers
I fixed all of these and indented correctly; the result is recurse2.pl
Next | Copyright © 2002 M. J. Dominus |