Drawing it out, as seen, using the Pythagorean theorem we get that w^2+l^2 (with w=width and l=length)=diagonal^2=24^2+l^2=40^2. Subtracting 24^2 from both sides, we get 40^2-24^2=l^2=1024. Square rooting both sides, we get l=32. Since the perimeter is 2w+2l, we get 32*2+24*2=64+48=112