Hello Andrew,

Looks like you might be new to the monastary. I'd like to suggest that in the future, you are more likely to get answers to your questions if you can come up with a minimal case that describes what you are trying to do rather than just pasting all of your code into a window. Monks are lazy busy people, and really don't like to have to read through a lot of extraneous fluff in order to sift through and find the actual question. In general, the shorter and more consise your question, the more likely you are to get a helpful answer.

Now, on to your question, if I understand your question, you want to avoid the first print statement if $id doesn't exist? If that is the case, there are a ton of ways to do that. First, you could just make your if block bigger:

if ( $id ) { print qq~ ... }

Or you could get sneaky and use perl's short-circut evaluations..

$id and print qq~ ...

Or you could add another 'if' statement:

print qq~ html stuff here... ~ if ( $id );

In reply to Re: If no results come back ... by ehdonhon
in thread If no results come back ... by andrew

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.