8. Given that the ratio of the square of the perimeter of rectangle $A B C D$ to its area is $k$. Then the ratio of the longer side to the shorter side of rectangle $A B C D$ is equal to
8. $\frac{k-8}{8}+\frac{1}{8} \sqrt{k(k-16)}$.

Let the length and width of the rectangle be $a$ and $b$ ($a \geqslant b$). Then $\frac{4(a+b)^{2}}{a b}=k$, which means $4 a^{2}+(8-k) a b+4 b^{2}=0$. Let $t=\frac{a}{b}$, then $4 t^{2}+(8-k) t+4=0$. Solving for $t$ gives $t=\frac{1}{8}[(k-8)+\sqrt{k(k-16)}]$.