- or download this
while (<>) {
# $_ holds the line read - process it here
}
- or download this
... (keys ...
- or download this
... (sort {length $sequences{$a} <=> length $sequences{$b} } keys ...
- or download this
$ cat pm_1144803_fasta.txt
>SequenceID|1234_Gene1
...
GTGCTGTCTTAAGTTGAACAGAGTGTGGGAGGAAATATAAGCAAAGTTATTCCGTAGAATT
>SequenceID|4567_Gene3
CATCCTCCTTTACACCCCACAAACATTTGGCAACCCCTGATAGGTTTCTTTCTTGTGGA
- or download this
$ cat pm_1144803_fasta_seq_len_sort.pl
#!/usr/bin/env perl
...
my $len = length ($sequences{$key});
print "$key:$len\n";
}
- or download this
$ pm_1144803_fasta_seq_len_sort.pl pm_1144803_fasta.txt
SequenceID|1234_Gene1:55
SequenceID|4567_Gene3:59
SequenceID|9876_Gene2:61