A Hamming code has 22r−r−1 words, and each radius-one Hamming ball contains 1+(2r−1)=2r vectors. Its minimum distance is three, so these balls are disjoint, and their total size is 22r−1. They therefore partition the ambient space, making the code perfect.