my $acc = new NGreatest($n); $acc->insert(\@arr); while <> { $acc->insert(chomp $_); } my @top = $acc->result();