#!/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.
In reply to Re: printing the length of string variables
by ikegami
in thread printing the length of string variables
by sugar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |