or download this
my $string = '1,3,5,7,9,1,3,4,5,6,2,1,5,6,7,9';
...
my $count = () = ",$string," =~ /,$num(?=,)/g;
print "$num\t$count\n";
}
or download this
my $string = '1,3,5,7,9,1,3,4,5,6,2,1,5,6,7,9';
...
for my $num (sort { $a <=> $b } keys %counts) {
print "$num\t$counts{$num}\n";
}