O keepers of infinite wisdom: I am working on a script which executes the following system call within a loop, iterations of which are counted by $iter:
goto CHARMM:; print "running charmm for iteration $iter with command: ~u0588832/bin/ +charmm < enm.calc.inp > charmm-out-iter-$iter.out\n"; system ("~u0588832/bin/c32b2/exec/gnu/charmm < enm.calc.inp > charmm-o +ut-iter-$iter.out"); if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; } else { printf "child exited with value %d\n", $? >> 8; } rename ("ic-fluc.dat" , "ic-fluc-iter-$iter.dat"); open(IN, "ic-fluc-iter-$iter.dat") || die "could not open internal coo +rd fluc file.\n";
the odd thing is that the child process runs just fine many thousands of times, then fails. the code exits on the open when it can't find the .dat file, which is an output of the system call. some more info: (1) the code seems to crash randomly, ie, on a different iteration. almost never makes it past about 10,000 iterations. (2) the child process runs fine if i paste the stuff inside the quotes onto the command line once the code crashes. i.e, all the input files for the system call are in order. (3) the value of $? is 0, even when the code crashes. (4) if i add a snippet
if(!(-e "ic-fluc.dat")){ print "can't find ic-flc.dat at iter $iter. rerunning +charmm.\n"; goto CHARMM; }
before the rename, the code loops endlessly through the goto once the system call fails the first time. this is really driving me nuts. seeking transcendence, ASAP.

In reply to strange failure of a system call by phatDissonance

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.