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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.