in reply to Uninitialized array woes.

You should check the return from sysread. If not defined you have a $! to act on ( you don't want to die on EAGAIN). It returns zero on eof or when zero bytes are read.

I don't understand what you mean by while ($client) {...} where $client looks like a filehandle on the following line. If you mean to say while (<$client>) {...} you shouldn't mix standard I/O with sysread, and the newline split is unneeded, as well.

If you have more than one $client, global the single $incoming is going to bite you.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Uninitialized array woes.
by rendler (Pilgrim) on Aug 26, 2002 at 05:29 UTC
    Hmm I've slashed it down to:
    while (my $recv = <$client>) { process_incoming($recv); }

    But this does not work correctly it randomly disconnects the client for some reason.

    Also it's made for one person to be connected to it, which I will eventually hardcode into it at some point. </code>