CLI-TextLines-Utils

 view release on metacpan or  search on metacpan

scripts/alluniq  view on Meta::CPAN

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
            return 1 if $o{q} ;
            print STDERR # {$o{q} ? \* STDOUT : \*STDERR }
              CYAN "Some counted lines are " , BRIGHT_RED "same.  "
              CYAN , "Different " , BRIGHT_CYAN (scalar keys %str2cnt) , CYAN " / All " , BRIGHT_CYAN $. . " ; " ,
              CYAN ,  "Maximum multiplication : " , BRIGHT_CYAN  max( values %str2cnt ) ,
              CYAN "  ($Script)\n"  ;
            return 1 ;
        }
}
 
sub tableOutput( ) {
    ## 2. 度数nの異なる文字列が、具体的にどんな値であったか。
    while ( my( $str, $cnt) = each %str2cnt ) {
       push @{ $cnt2strs {$cnt} }, $str ;
    }
    my $msep = $o{2} ? "\n" : "\t"  ;
    print $o{2} ? "mult\tfreq\n" : "mult\tfreq\texamples\n" ;
 
    for my $count ( sort { $a <=> $b } keys %cnt2strs ) {
        print "$count\t", scalar @{ $cnt2strs {$count} }, $msep ;
        next if $o{2} ; # -2 指定の場合は、該当文字列の例を出力しない。



( run in 0.261 second using v1.01-cache-2.11-cpan-e9199f4ba4c )