Some of your SQL statements look very similar to each other in sub process_dsa_dsm. You might want to replace the interploted strings with placeholders and pass in the parameters in the execute. This will increase the efficiency of the SQL parsing (as will using table aliases and qualifying all fully column names). Also, I would (personal opinion, of course) refrain from building the SQL directly in the prepare statement, but instead use a scalar variable instead - it can greatly aid debugging, especially when using complex queries, (and, personally I wouldn't be using something as important as @row so inconsistently - sometimes global, sometimes a parameter).

The parameter passing in update_record can be more easily accomplished using a list assignment, e.g.

my ($new_status,$scr_date,$pros_id, $tsr_name,$sales_rep_name,$prod_code, $leadsht_id,$curr_status) = @_;
The code obviously works, so ++ for that, but you might want to reconsider the use of so many globals: maintaining the code as it stands, I believe, would tend to increase the complexity (i.e. increase the 'spagetti'ness).

rdfield


In reply to Re: Review of first real code by rdfield
in thread Review of first real code by SPIDEY

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.