Hi All,
I'm attempting to learn IO::Socket and have hit a snag with this bit of
code:
while (my ($client, $client_address) = $server->accept()) {
my ($port, $packed_ip) = sockaddr_in($client_address);
my $client_ip = inet_ntoa($packed_ip);
my $stamp = ×tamp;
print LOGFILE "$stamp - Client ($client_ip) connected.\n" if $DEBUG ==
1;
$client->recv($recv, 128);
chomp($recv);
if (exists($commands{$recv})) {
$client->send("Works! Received: $recv");
} else {
$client->send("Doesn't work! We received this: $recv");
}
}
The code above doesn't print out anything for $recv, however if I remove the
chomp($recv) it works fine. Anyone got any idea's why running a chomp on
this variable causes it to not be displayed at all? The variable does
contain a newline so I do need to have it removed.
Thanks,
Shane
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html