Re: [Spoiler] QotW 23

Daniel Martin <martin-+m399P62/[email protected]>
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
Rod Adams <[email protected]> writes:

> btw,
> change
>
>    my $limit = index $item, ')';
>
> to
>
>    my $limit = index $item, ')';
>    $limit = 0 if $limit < 0;
>
> and the seed from '()' to '', and you should be able to handle n=0.
> Oh, it looks like you have to move the print test to the start of the while loop.

That's enough code that's used only in one case that it's worth
special-casing the n=0 case outside the loop as I did in my faster
solution.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.