problema con il funzionamento
mi da questo errore:
Can't use an undefined value as a symbol reference at socket.pl line 21, <stdin> line 1.
mi da questo errore:
Can't use an undefined value as a symbol reference at socket.pl line 21, <stdin> line 1.
Codice:
#!/usr/bin/perl
use IO::Socket;
$host=$ARGV[0] || "Usage: perl $0 <web_server> <port> <protocol>\n";
$port=$ARGV[1] || "Usage: perl $0 <web_server> <port> <protocol>\n";
my $sock = new IO::Socket::INET(
PeerHost => $host,
PeerPort => $port,
Proto => tcp,
);
for (;;)
{
print "request to the server?";
$richiesta= <stdin>;
print $sock "$richiesta\n\n";
while (<$sock>) {
print $_;
}
close($sock);
}