So last time I asked this question all I got was commits on how my perl code was not “proper” (although I thought one of the nice things about perl was I could write it how it looked best to me and it still work). So this time around I am hoping to get help with my problem and not just a bunch of people telling me to change the way I program.
Here is the problem. I have a small script that connects to a MS SQL database, runs a view, and displays the result. When I run the view in the SQL management studio a valid result is always shown and when looking directly at the data in table the view pulls from there is no blank rows. But when the view is called via the perl script a blank row will sometimes be pulled. So can anyone look at my code and tell me what in it would be causing a blank row to be pulls.
SQL Code: select top 1 Quote, CharacterName, GameTiel from dbo.GameQuotes order by newid()
Perl Code:
#!C:\Perl\bin\perl.exe use strict; use DBI; use CGI::Carp qq~fatalsToBrowser~; print "Content-type: text/html\n\n"; my ($DBH, $STH, @Quote, $Statement); $Statement = qq~select Quote, CharacterName, GameTitle from Finaldbo.R +andomQuote~; $DBH = DBI -> connect('dbi:ODBC:SQLServer', '', '') or die "$DBI::errs +tr"; @Quote = $DBH -> selectrow_array($Statement); print qq~$Quote[0] <br />--$Quote[1] <br />$Quote[2]~; $DBH -> disconnect;

In reply to Let's try this again. Script pulling mysterious blank row. by MatthewV

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.