I have a program that generates a hash and starts passing it to misc subroutines for them to act on. I am trying to generate a return code from GPG encryption (one of the subroutines) and if it errors, have the return code be passed back out to the main subroutine which then prints an error and exits if the return code is "1". The problem Im having is that its not working - here is an ex of how its layed out:
if (%hash = sub(%temphash) != 0) { print "ERROR! - sumthin broke\n"; $error = 1; exit; } (nothing important here) return(1) if ($error != 0);
where the subroutine just does the encryption of a text file and moves it to a different directory. I have the encryption subroutine exit and print $@ if it has a value, but the whole thing still exits... ideas? (I ask knowing you are prolly gonna want the actual code here, but sorry - its at work) oakley

In reply to return codes from embedded subroutines by oakley

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.