http://qs321.pair.com?node_id=50061


in reply to What Happened...(perils of porting from c)

I went and looked.

First of all I strongly suggest using strict up at the top, it will catch even more errors for you. Of course you need to use vars as well.

After that fixing it to work is just a matter of walking through and fixing complaints. You have an extra ')' before a ||. One-line for loops need to either change the format or need the braces. There are a few undeclared variables. A few more cases where // is used instead of # for a comment. A few $ missing. (ie You want --$level rather than --level.) Your final return statement should not be there.

All of this is pretty mechanical, but I am loathe to post the final result since the resulting code is very ugly. A native Perl version of this would be easy to write and would look much nicer. Perhaps if I get some time...