Help for this page

Select Code to Download


  1. 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";
    }
    
  2. or download this
    1       3
    2       1
    ...
    7       2
    8       0
    9       2
    
  3. 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";
    }
    
  4. or download this
    1       3
    2       1
    ...
    6       2
    7       2
    9       2