coding theory- perfect codes
Guidelines for the future: start with reviewing the definitions.

According to Wolfram, a perfect code (with distance $d=2e+1$) is one such that "for every possible word $w_0$ of length $n$ with letters in $A$, there is a unique code word $w$ in $C$ in which at most $e$ letters of $w$ differ from the corresponding letters of $w_0$."

OK, but this is cheating.

So let's start with an equivalent definition:


  A code $C$ is perfect if it attains the Hamming bound


what is this Hamming bound? Basically, it's a counting argument. If you have a word $w\in F^n_q$, how many words are there with in $F^n_q$ whose distance from $w$ is at most $e$?
If you do the counting, you will get there are exactly $\sum_{i=0}^e \binom{n}{i} (q-1)^i$ such words. [Why? If the distance is $i$, choose $i$ indices (out of the $n$ possible indices), each such index can get any of the $q-1$ different values from $w$ in that index.]
The bound then says that if we split the universe into disjoint "balls" where each ball contains a center $w$ and all the $\sum_{i=0}^e \binom{n}{i} (q-1)^i$ words within distance $e$ from $w$, we will have at most $$\frac{|F^n_q|}{size(ball)} = \frac{q^n}{\sum_{i=0}^e \binom{n}{i} (q-1)^i}$$ such (disjoint) balls.

A code that attains the Hamming bound means that any word is within distance $e$ of some codeword. That is, if you think on each codeword in $C$ as a center of a ball with radius $e$, then the codewords cover the entire universe: no word in $F^n_q$ is left outside some ball. Note that the distance of this code is $2e+1$: two codewords belong to two different "balls", and each ball is of radius $e$ (in Hamming distance).

But if the entire space is covered with balls, it means that any word is within distance $e$ of some codeword. This is exactly the first definition I wrote in this post. Thus, if you take any other word and make it a codeword, this word already belongs to some ball, so it is within distance $e$ from the center of that ball, and the new code cannot have a minimal distance greater than $e$.