in reply to print() wierdness

You appear to be reading and writing to a filehandle named CLIENT which you are assuming is already open and you are pulling in by a global. That probably is not going to work, and if it does it likely is not doing what you think it is.

Aside from that you are using globals everywhere, goto rather than redo, so on and so forth. For your sanity I strongly recommend that you never again use a goto (if you have any construct that you feel demands it then ask here for how to do it more sanely without), use strict, declare variables lexically with my, and so on.