in reply to Sloooooow algo in Perl

What exactly is this code supposed to do? I can't figure it out.

Do you have some examples with input and output?

update: and is there a special reason you're not using strict?