Help for this page

Select Code to Download


  1. or download this
    my %count;
    my $total;
    ...
    
    # iterate %count to see how many the pattern shows up on each line
    # $total is the total number the pattern shows up in the file
    
  2. or download this
    my(%count, $total);
    while (<FILE>) {
    ...
      $count{$.} = $seen{$target};
      $total += $seen{$target};
    }