Based on those error messages, I'd say at least some of your errors are on or near lines 77, 109, and 110. Another error occurred somewhere there, too, but that missing curly/square bracket error is a bit loose on its guess.

Lines 75-77 of what was posted:

$dbh = ("DBI:mysql:host=localhost; database=blah", "blah", "blah", {PrintError => 0, RaiseError=>1});
I think you're missing the "DBI->connect" part before the opening parenthesis. As for lines 109/110, on line 112, you use a variable $index which was not local'd or my'd anywhere prior. I'm not sure whether this is supposed to be a new variable or what scope you want it - probably right before the while loop for reading the file.

Finally, your missing close-brace is that your process_files sub doesn't close properly - not as many }'s as {'s. I'm guessing that if you add a brace right before the line that says "sub usage", that would go away, too.

Given the line numbers I'm getting here vs your error messages, I'd wager that the code you posted is not precisely the code you tested. That's something I'd like to highly discourage you from doing - it's much harder to debug a virtual problem than a concrete one. And it's even harder to debug a virtual problem that's masquerading as a concrete one via some misleading code.


In reply to Re: Finding local vs Global Error by Tanktalus
in thread Finding local vs Global Error by Cappadonna3030

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.