#!/usr/bin/perl # includes and dependencies.... use strict; use warnings; my $max_clients = 10; my $port = 15100; while(1) { my $sock = new IO::Socket::INET ( LocalHost => 'localhost', LocalPort => $port, Proto => 'tcp', Listen => $max_clients, Reuse => 1, ); die "Could not create socket: $!\n" unless $sock; my $new_sock = $sock->accept(); while(<$new_sock>) { # parse information close($sock); #send e-mail function here unless(fork) { # sleep for given time sleep(30); # perform function #2nd send e-mail function here exit(0); } } }