A few points:
- Everybody in this monastery should tell you that you should use strict and warnings.
- If that "$CGI-DIR" means anything serious, you should also have Taint checking. If it doesn't (as I strongly suspect and "-w" could have told you), what is it doing there?
- Using DBI, you should either checking for an error after "connect", or set {RaiseError => 1}.
- data in a datbase is seldom reduced to a single table. And even if it is, getting data from a table without a "WHERE" clause, can fetch you a million records for no sensible reason.
- I fail to see the logic behind assigning $a =$#row and then incrementing it. How about
while (my @row=fetchrow_array()) { print join ",", @row; print "\n"; }
- what is the point in clearing the screen, if you are sending the output to a file?
- "seperate" should be spelled "separate"
- you are assuming that the user knows SQL, since (s)he is supposed to enter special options. What is the purpose of using this "utility" if I can do the same with an one-liner?
$ mysql -t -u user -p -e "SELECT blah,Blablah from my_table" I could continue, but I think it's enough.
gmax

In reply to Re: Get From DB by gmax
in thread Get From DB by mortehl

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.