in reply to Perl overwriting some lines

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

Replies are listed 'Best First'.
Re^2: Perl overwriting some lines
by perlbrahmin (Initiate) on Nov 17, 2009 at 15:29 UTC
    Thanks for the enlightenment I was not aware that Perl debugger can do all this. Will use it and report back if the problem persists