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.


Perl is environmentally friendly - it saves trees

In reply to Re^5: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE by GrandFather
in thread Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE by Nik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.