in reply to Sliding window perl program

You've been here before. Using <c> tags is not that hard.

Update: You are incrementing $up within the for loop within the while loop, so you aren't comparing the range you think you are after the first $file2. You probably want to set the value of $up before the for loop.

Further Update: much more readable! I see my guesses about the code were correct. If you can properly indent it as well, the structure of the code will become clearer, and that's to your benefit; it will be easier to see why it does not work.

BTW: variable $c has no apparent purpose. You set it to zero, and then conditionally increment it, only to zero it again next range.

Dum Spiro Spero

Replies are listed 'Best First'.
Re^2: Sliding window perl program
by genome (Novice) on Oct 20, 2015 at 20:15 UTC
    Please have a look now.

      Just for fun, I did. Here's what happened:

      $ perl -cw 1145471.pl Unquoted string "p" may clash with future reserved word at 1145471.pl +line 6. Scalar found where operator expected at 1145471.pl line 11, near "$up" (Missing semicolon on previous line?) Scalar found where operator expected at 1145471.pl line 12, near "$dn" (Missing semicolon on previous line?) Scalar found where operator expected at 1145471.pl line 23, near "$c" (Missing semicolon on previous line?) Unquoted string "p" may clash with future reserved word at 1145471.pl +line 24. Scalar found where operator expected at 1145471.pl line 31, near "$up" (Missing semicolon on previous line?) syntax error at 1145471.pl line 6, near "p>" syntax error at 1145471.pl line 10, near "chomp" syntax error at 1145471.pl line 11, near "$up " syntax error at 1145471.pl line 15, near ") {" syntax error at 1145471.pl line 19, near ") {" syntax error at 1145471.pl line 21, near "100) " syntax error at 1145471.pl line 24, near ") <" syntax error at 1145471.pl line 29, near "}" syntax error at 1145471.pl line 33, near "}" 1145471.pl had compilation errors.

      Do you see the problem?