use strict; use IO::Socket; my $server = "192.168.1.106"; my $sock = new IO::Socket::INET->new( PeerAddr => $server, PeerPort => 4998, Proto => 'tcp', Type => SOCK_STREAM, ); $sock or die "no socket for $_: $!"; $sock->autoflush(1); #Send a device command ending with return (slash r) print $sock "getdevices\r"; #here is where i am stuck... while (<$sock>) { print "$_\n"; }