in reply to Working with IO::Socket in thread.

You're starting your thread and then your main thread does nothing else, so it just runs off the end of the script and the whole script terminates.

Try adding  sleep 60; after you create the thread. The program will then read and display any input from the socket for 60 seconds before terminating.

Of course, normally your main thread would go about doing whatever else it should be doing, the sleep is just to demonstrate the problem with your code as posted.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.