IO::Socket::INET写的client端程序

IO::Socket::INET写的client端程序

#!/usr/bin/perl

use IO::Socket;

$remote_host='127.0.0.1';
$remote_port='3000';
$socket=IO::Socket::INET->new(PeerAddr=>$remote_host,
                PeerPort=>$remote_port,
                Proto=>"tcp",
                Type=>SOCK_STREAM)
or die "Couldn't connect to $Remote_hostremote_port@\n";
print $socket"Why don't you call me anymore?\n";
$answer=<$socket>;
close($socket);




出现错误提示:string found where operator expected at tr1 line 12 ,near "$socket"why don't you call me anymore?\n"

(Missing operator before "Why don't you call me anymore?\n"

couldn't connect to :3000::IO::Socket::INET……


QUOTE:
原帖由 洲洲young 于 2008-12-23 17:21 发表
#!/usr/bin/perl

use IO::Socket;

$remote_host='127.0.0.1';
$remote_port='3000';
$socket=IO::Socket::INET->new(PeerAddr=>$remote_host,
                PeerPort=>$remote_port,
             ...

少个空格?
print $socket "Why don't you call me anymore?\n";