4. Given $P(2,1)$, draw a line $l$ through point $P$ that intersects the positive $x$-axis and $y$-axis at points $A$ and $B$ respectively. Then the equation of the line $l$ that minimizes the perimeter of $\triangle A O B$ (where $O$ is the origin) is $\qquad$
$$
4.3 x+4 y-10=0 \text {. }
$$

As shown in Figure 2, let $\angle B A O = \theta, t = \tan \frac{\theta}{2}$. Then the perimeter of $\triangle A O B$ is
$$
\begin{aligned}
s= & (2+\cot \theta)+ \\
& (1+2 \tan \theta)+ \\
& \left(\frac{1}{\sin \theta}+\frac{2}{\cos \theta}\right) \\
= & 3+\frac{1+\cos \theta}{\sin \theta}+\frac{2(1+\sin \theta)}{\cos \theta} \\
= & 1+\frac{1}{t}+\frac{4}{1-t} \\
= & 6+\frac{1-t}{t}+\frac{4 t}{1-t} \geqslant 10 .
\end{aligned}
$$

Equality holds if and only if $\frac{1-t}{t}=\frac{4 t}{1-t}$, i.e., $\tan \frac{\theta}{2}=\frac{1}{3}$. 
Then the slope of $l$ is $k=-\tan \theta=-\frac{2 \tan \frac{\theta}{2}}{1-\tan ^{2} \frac{\theta}{2}}=-\frac{3}{4}$.
Therefore, the equation of $l$ is $3 x+4 y-10=0$.