Hi ,

I have done a silly mistake which am not able to detect.

Below is a subroutine, that takes the Socket_Handle and the Message as arguments.
First i send the message and then I start reading the Socket in a while loop until 
DONE is detected.
I am pushing each line in a @buffer.

When I print the @buffer outside the while loop , I am not getting the output.

Note : The commented line i.e. #print "Server: $_"; works and prints all the lines 
read from the socket.

Please somebody tell me what error have I been making.

Regards
Rajeev
****************************************************
sub send_msg {
    $sock = shift @_;
    $msg = shift @_;

    my @buffer;

    select($sock);
    $| = 1;
    select(STDOUT);

    print $sock $msg, "\n";
    while (<$sock>) {
    if( $_ =~ /^DONE$/) {
        print "Server: $_";
        return;
    }
    #print "Server: $_";
    push @buffer, $_;
    }
    print @buffer;
}

*************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to