haukex and syphilis have already provided some good answers but I thought that I would point out some things that I didn't see mentioned.
Perl's int is not the same as C's floor(). What you want is POSIX::floor. It has the identical behavior as C's floor().
Perl has a pre-decrement just like C.
# for(int i = len; i > 0; --i) { # C # for(my $i = $len; $i > 0; $i--){ # incorrect Perl for(my $i = $len; $i > 0; --$i){ # correct Perl
YMMV as I haven't tried it out with these changes implemented.
In reply to Re: porting C code to Perl
by Mr. Muskrat
in thread porting C code to Perl
by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |