Well, I'm not sure how much usefull information you're going to get out of the files you save ... I generally presume most of these folks are using throw away IPs from dialup ISPs. The sleep(5) looks like the best part of this whole thing to me since a spammer is less likely to use a site that seems to take 5 seconds to "send" a msg.
But why stop at 5 seconds? and why only waste their time, when you can waste their RAM? (and if they are acctually loging your CGI output for any reason: their disk as well)
...
while (1) {
sleep rand(5);
my $r = rand(100);
for (my $i = 0; $i < $r; $i++) {
print "die you filthy low life scum bag, die!!!";
}
}