An element $a$ of a ring $R$ is called perfectly clean if there exists an idempotent $e\in\comm^2(a)$ such that $a-e\in U(R)$. A ring $R$ is perfectly clean in case every element in $R$ is perfectly clean. In this paper, we completely determine when every $2\times 2$ matrix and triangular matrix over local rings are perfectly clean. These give more explicit characterizations of strongly clean matrices over local rings. We also obtain several criteria for a triangular matrix to be perfectly J-clean. For instance, it is proved that for a commutative local ring $R$, every triangular matrix is perfectly J-clean in $T_n(R)$ if and only if $R$ is strongly J-clean.