#!/usr/bin/perl use warnings; use strict; my $inf=shift @ARGV || or die "Need to give a input file.\n"; open (INF,shift @ARGV); sub print_map (\$\$) { my $name_r=shift @_; my $code_r=shift @_; my %hash; print "$$name_r\n"; while ($$code_r=~m/(\w)/g) { $hash{$1}++;} foreach (sort {$a cmp $b} keys %hash) { print "$_: $hash{$_}\n"; } } my ($code,$name); while () { chomp; if (m/^>(.+)/) { print_map ($name,$code) if ($name); $name=$1; } else { $code.=uc($_); } } print_map($name,$code); exit;