Help for this page

Select Code to Download


  1. or download this
    while($text=~/\b(\w+)\b(?=.*\b\1\b)/g){
        $words{$1} //= 1;  # initialize empty value to one
        $words{$1}++;
    }
    
  2. or download this
    use strict;
    use warnings;
    ...
    foreach my $key (keys %words){
        say "$key: $reps{$key}";
    }