in reply to Re^4: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE
in thread Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE
maybe there isn't a tab character in the string you are trying to split?
Have you tried debugging the code yourself at all? Something simple as a sanity check would be to:
foreach my $filename (@files) { ... while (<FILE>) { chomp; next unless length; #Skip blank lines my @params = split /\t/, $_, 2; unless (2 == @params) { warn "Line $. in $filename badly formed\n"; next; } $insert->execute() or print $db->errstr; }
It is worth thinking about how stuff could go wrong rather than how it might go right. It is also worth checking documentation for any construct you are not absolutely sure about. Getting to know your way around the documentation for whatever you are doing is generally much better in the long run than crawling cap in hand to PerlMonks every time you hit a problem. We much prefer to solve interesting problems rather then dumb ones that are more due to laziness than inexperience.
|
|---|