how can I check the return value of open an close in an easy way?

In what sense is open( ... ) or die "..." not sufficient for you? (The same works for "close", but in a unix/linux environment, it's unlikely closing a file handle will ever be a problem -- I gather it can be an issue on mswindows.)

If there are still problems with running the sub-process from within the script, you should print the command line to STDERR before trying to execute it, so you can see what the sub-shell is being given, and then try running that manually to see what happens. Given that the segfaults are intermittent, they are caused either by the data being used to build the command line, or else by other conditions on your machine that are external to your perl script. (If the script starts multiple sub-processes within a single run, there's also a possibility of interference or confusion among sub-processes.)


In reply to Re^4: segmentation fault by graff
in thread segmentation fault by lbarbago

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.