[geeks] One of these days....

James Sharp jsharp at psychoses.org
Mon Apr 15 17:54:44 CDT 2002


> Can you show the code?
>

#!/usr/bin/perl
use IO::Socket;
$sock = IO::Socket::INET->new(PeerAddr => 'localhost', PeerPort =>
'8888');
$sock or die;

while (<$sock>) {

($temper,$dummy,$dummy,$windsp,$dummy, $dummy,
$direction,$dummy,$dummy,$dummy,$dummy,$dummy) = split(/ /,$_);

$newtemp = (1.8 * $temper)+32;

print "Temp:  $temper NewTemp: $newtemp WindSp: $windsp Direction:
$direction\ n";

}


The results:

weatherman$ ./weatherwrapper.pl
Temp:  26.0 NewTemp: 78.8 WindSp: 1.1 Direction:  14
Temp:  26.0 NewTemp: 32 WindSp: 1.1 Direction:  14
Temp:  26.0 NewTemp: 32 WindSp: 1.1 Direction:  14

So somewhere between the first and second iterations, it suddenly decides
that math is hard and it wants to go shopping.



More information about the geeks mailing list