use warnings; # Handy use strict; # Even more handy use IO::Socket::INET; my $socket = IO::Socket::INET->new ( LocalPort => $config{'listenport'}, Proto => 'udp', Reuse => 1, ) or die "Can't create listening socket: $@\n"; while (1) { my $indata; # Read some data from the serial port # Read some data from a few files # ~300 lines of calculations go here, putting it all into $outdata when done shipout($outdata); # flush buffers, and other stuff } sub shipout { my $datatoship = shift; # these lines should be replaced by something that # that sends the contents of $datatoship to # everyone (or anyone) that is connected to $socket # if none is connected, just move on. } __END__