Example 1 There are 2012 lamps, numbered $1, 2, \cdots, 2012$, arranged in a row in a corridor, and initially, each lamp is on. A mischievous student performed the following 2012 operations: for $1 \leqslant k \leqslant 2012$, during the $k$-th operation, the student toggled the switch of all lamps whose numbers are multiples of $k$. Question: How many lamps are still on at the end?
Let $1 \leqslant n \leqslant 2012$, we examine the state of the $n$-th lamp. According to the problem, the switch of this lamp is pulled $d(n)$ times. An even number of pulls does not change the initial state of the lamp, while an odd number of pulls changes the state of the lamp from its initial state.

Using the properties of $d(n)$ and the previous discussion, since there are exactly 44 perfect squares among the numbers $1,2, \cdots, 2012$, it follows that finally, $2012-44=1968$ lamps are still on.