Check the date on the output file. My guess is that that file was produced by a previous version of your script and then wasn't written to for a long time.

Whether that is the case or not, you might try to enhance your bug searching a bit:

Instead of putting in code that pauses at a specific point in time (what you tried with the $printer variable) and then checking the output file you should inspect your script at that time. Use the perl debugger and put a break point at a relevant line and with a condition. In your case you would do something like the following:

perl -d <yourscript> <parameters>
h gives you a short help screen, you can find out more with h <command>
h
l lists a few lines of your script, do until you find the line you want to stop at (or enter l 50 to list around line number 50)
l l l
lets assume line 32 is where you want to stop, but only if $searchstart is 1297
b 32 $searchstart==1297 c
the script now runs until it stops directly before executing line 32 when $searchstart has value 1297. If not, that line either was never executed or $searchstart never had the value 1297 at that line. Alternatively you could use "w $searchstart==1297" which would break the moment that condition is true

now you can single step

s s
and print any variables
p $startcord p @orthologous p $starthash{$i}

You see, the perl debugger is really not that difficult to use

The alternative to the debugger is to use temporary print statements in your code to check the variables, for simple tests it might be even faster, for serious bugfixing it is more work


In reply to Re: Perl overwriting some lines by jethro
in thread Perl overwriting some lines by perlbrahmin

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.