- state $seen;
- my $count = $seen->{ $_->[0] }->{ $_->[1] // '' }++;
- next if $count >= ($opt{min} // 0) + ($opt{max} || 1);
- next if $count < ($opt{min} // 0);
+ my $counter = \$headercount{ $_->[0] }->{ $_->[1] // '' };
+ my $excess = $$counter++ - ($opt{min} // 0);
+ next if $excess >= ($opt{max} || 1);
+ next if $excess < 0;
+ if ($opt{count}) {
+ push @headercache, [ $line, $excess ? \undef : $counter ];
+ next;
+ }