Example 5 Find all integers $n$, such that
$$
n^{4}+6 n^{3}+11 n^{2}+3 n+31
$$

is a perfect square.
$(2004$, Western Mathematical Olympiad)
Let $A=n^{4}+6 n^{3}+11 n^{2}+3 n+31$. Then
$$
\begin{array}{l}
A=\left(n^{2}+3 n+1\right)^{2}-3(n-10) \\
=\left(n^{2}+3 n+2\right)^{2}-\left(2 n^{2}+9 n-27\right) .
\end{array}
$$

When $n \geqslant 3$ or $n \leqslant-7$,
$$
\left(n^{2}+3 n\right)^{2}<A<\left(n^{2}+3 n+2\right)^{2} \text {. }
$$

Therefore, $A=\left(n^{2}+3 n+1\right)^{2}$.
Thus, $n=10$.
When $-6 \leqslant n \leqslant 2$, it can be verified that: $A$ is sequentially 409, 166, 67, 40, 37, 34, 31, 52, 145, none of which are perfect squares.
In summary, the integer $n=10$.