in reply to how to count the no of repeats in a string

You can use the CPAN module Statistics::Frequency.

use Statistics::Frequency; my $string = '1,3,5,7,9,1,3,4,5,6,2,1,5,6,7,9'; my %count = Statistics::Frequency::->new(split /,/, $string)->frequenc +ies; print "$_: $count{$_}\n" for sort keys %count; __END__ 1: 3 2: 1 3: 2 4: 1 5: 3 6: 2 7: 2 9: 2

lodin

  • Comment on Re: how to count the no of repeats in a string (Statistics::Frequency)
  • Download Code