First, I strongly recommend
strict. See
use strict and warnings. It might seem like a hassle now that the script is mostly written, but it would've been easier if you started with it, and it'll be easier to maintain in the future.
Second, using prepare_cached WITHOUT placeholders (with variable arguments) is a very bad idea. You WILL use alot
of memory if there is alot of unique input. If your insert statement will have a limited number of table names, then use prepare_cached, but use it WITH placeholders (search this site and see the DBI docs). If you're going to have an unlimited number of table names per script, then use prepare instead of prepare_cached, but DO still use placeholders (with most databases, the table name can not be a placeholder argument, it might be different with mysql, though not portable).
Last, you're not checking the status of any of your DBI calls (except the connect). You might want to look into RaiseError (see the DBI docs), and wrap the whole thing in an eval{}, then check $@, or check the status of each DBI call (prepare, execute, etc.).
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.