http://qs321.pair.com?node_id=11107502


in reply to Re^8: How to write to a file?
in thread How to count the length of a sequence of alphabets and number of occurence of a particular alphabet in the sequence?

Your input file seems to contain an empty line, but the script does not provide for it.

If empty lines are ok, you could define something like
my $rx_empty = qr{ \A \s* \z }xms; # empty line (or whitespace on +ly)
and after the chomp
if ($record =~ $rx_empty) { # ignore next RECORD }