in reply to printing the length of string variables

The solutions provided seem very complex. Here's something simpler:
#!/usr/bin/perl use strict; use warnings; for (;;) { my $head = <>; my $body = <>; last if !defined($body); chomp( my $seq = $body ); my $len = length($seq); $head =~ s/(length=)\d+/$1$len/; print($head, $body); }

Update: Length was off by one because of lack of chomping. Fixed. Thanks graff.