You should check for errors everywhere something could potentially go wrong. Most of us assume certain operations (e.g. print to STDOUT) will always succeed, which is a pretty good bet, so you don't check on every single print (but you should check on print's to files or pipes, where failure is more likely).

If your program can recover and continue operations, use warn to let the user know that something didn't happen as expected. If there is no way the program can continue, use die.

Just be careful to properly check for errors and not use or die/warn blindly. The example that comes to mind is system, which returns the status as returned by the command executed, so that zero means "no error" and non-zero values indicate error conditions (i.e., the opposite of the usual indication in Perl).

--ZZamboni


In reply to Re: Death can be such a Tragedy by ZZamboni
in thread Death can be such a Tragedy by zdog

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.