in reply to Uninitialized value in substr command

$element2 at least is running away and therefore you are trying to read beyond the end of @contigfile in your substr call. Hence the warning message.

If you must do it using this algorithm (and TIMTOWTDI but it wouldn't have been my choice) it would be wise to test that both $element1 and $element2 are not outside the bounds of the array. I'd also suggest you use strict.

Replies are listed 'Best First'.
Re^2: Uninitialized value in substr command
by lmtaylor (Novice) on Aug 21, 2014 at 17:42 UTC
    Thank you for your help! What does TIMTOWTDI mean?
      TIMTOWTDI is one of the Perl mottoes: "there is more than one way to do it."