First I would like to thank you, Grandfather, and Mike Lieman for such quick replies.
What fetchrow_array returns in scalar context is undocumented. $data1 = $sth->fetchrow_array(); is wrong. If you want to the first field, use ($data1) = $sth->fetchrow_array();
Thank you I will take your advice here.
Is the contents of $dberror text of HTML? You put both into it. At wor +st, this could be an opening for a cross-site scripting attack.
I do ultimately call $dberror in my html code yes. I do not understand what you mean by stating I put both into it? Again please forgive me this is my first attempt at coding anything.
All over, you are instructing Perl to ignore prototypes. Why do you us +e & on your subroutine calls?
I was under the impression that this was proper usage... All the examples I discovered on the web used the & before the subroutine.
I note a distinct lack of my. Use use strict;!
Again please forgive my inexperience here... I did a fast google search to find the benefit in using "my()".. am I correct in stating the primary reason in using "my()" is so that the variables are completely hidden from the outside?
Something tells me you don't use warnings either. ("if ($data1 ne $dig +est1)" would warn if fetchrow_array returned zero rows.) Use use warn +ings;!
I actually want it to return with zero rows, I do plan on adding DBI error codes for my prepare and execute commands.
Why is six in quotes in "if (scalar @row1 == "6")"? You want to compar +e with the number 6, not the string "6" (which would be converted to +a number by ==). The scalar is useless too. == creates a scalar conte +xt, so scalar is redundant.
My goal with this statement is to see if my @row1 has 6 elements, and if it does proceed on. So if I read what you stated, I could accomplish the same thing by doing this
if (@row1 == 6) { other code here ... };
??
for my $row ( 1 .. $#rows ) { if (@{ $rows[$row] } == "6") { my @entry = (@required , @row); ... } }
Thank you for this! In trying to understand how this statement works, could I trouble you once more to explain how this exactly works? Again Thank you for you help thus far!!

Mike, Thank you for your input, and I have tested this to the best of my ability so I believe my script is at a good point for "cleaning up". Hopefully I am not being ignorant, are their other ways to test my script other than using my program, and getting the results I hope for? I do try to "break" it by putting in invalid data, etc.

Grandfather, @row1 is an array that is put together earlier after parsing data from a html form. So the scalar line is to look to see if it has all the required elements before it proceeds on with the script. Ideally there should only be 6 or 0 elements in the array, but to be thorough, and sure that information is being entered correctly and completely I wanted to be sure there were 6 elements in the array. Hopefully that's clearer than mud...

In reply to Re^2: Cleaning up Code by atmosphere
in thread Cleaning up Code by atmosphere

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.