in reply to printing the length of string variables

You're printing information for every line of the file, even if you haven't yet seen a line for which you want to print the length. You should instead read a line for the ID number and length, then read a line for the base sequence, and only then print.

If that doesn't work, post your next attempt and this time use strict and warnings, and it'll be easier to help you.

  • Comment on Re: printing the length of string variables