in reply to Clean Code - What a mess...

I see no database disconnect here. This error will be more noticable when you (and you really should :) ) turn on warnings.
I see no use of sendmail objects here. (although it might be importing something; I'm not so familiar with it)
Your SQL statements could benefit from a for loop, here's one way (among many) for your INSERT statement:
my @ins_fields= ("log"); my @ins_values= ("''"); for (1..25) { $writer[$_ -1] = "value of writer". ($_-1) ; push @ins_fields, "log$_"; push @ins_values, $writer[$_ -1]; } my $ins_fields = join ",", @ins_fields; my $ins_values = join ",", @ins_values; print "INSERT INTO $log ($ins_fields)\nVALUES ($ins_values)";


There are other ways of doing this, of course, and they're all fun to discover ;-)
for your series of regexen :
$findings=~s/,//g; $findings=~s/ /_/g; $findings=~s/\///g; $log="$findings"; $log=~s/:/_/g; $log=~s/\./_/g; $log=~s/___/_/g; $log=~s/__/_/g;
some of these can be 'optimized' by using tr///; always consider this when you have a direct 1-to-1 relationship between characters in and characters out, or when deleting chars. Your final 2 can be reduced to one regex, whose form depends on the answer to "are series of 4 or more underscores possible? would they be relevant in ways that 2 and 3 aren't?" Take a look at this snippet :
for (1..10) { my $foo = "_" x $_; $foo =~ s/_+/_/; print "method one : $foo\n"; my $foo = "__" x $_; $foo =~ s/___?/_/; print "method two : $foo\n"; }
The first one will take up any number of underscores and replace with a single underscore. The second will look for only two or three in a row, if there's 4 or more, it doesn't care. Whether this is relevant depends on your data.
Be sure to check the results of $sql->execute() -- if it's dying silently, what are the ramifications? use something like $sql->execute() || warn "SQL Execution failed! $DBI::errstr\nscript is $script";
Ok?

Replies are listed 'Best First'.
Re: random DBI suggestion
by PyroX (Pilgrim) on Nov 29, 2001 at 04:26 UTC
    Sendmail is there due to the fact that there is a function commented out, #mailman() and that code I did not include, thanks for all your help though! Everyone is helping so much I can't believe it, all great tips!
Re: random DBI suggestion
by grinder (Bishop) on Nov 29, 2001 at 18:57 UTC
    I see no use of sendmail objects here. (although it might be importing something; I'm not so familiar with it)

    sendmail is exported by the Mail::Sendmail module. It is somewhat unfortunately named, as it is a pure-Perl module, and does not require an external program (such as /usr/bin/sendmail). The author himself realises that it is poorly named, and were he to do it all over again, he would choose the name Mail::Simple.

    --
    g r i n d e r