@pjs' advice is very good advice, however since the damage is already done, how can you re-install it?
- Download the source code
- Compile the program by running the following command on the commandline in directory that you downloaded which.c to:
gcc which.c -o which
- Copy the output file to /usr/local/bin:
cp which /usr/local/bin