in reply to Why is this code so much slower than the same algorithm in C?
BrowserUK gave a pretty precise and technical answer to this problem. What it counts is the actual machine code that is finally executed and not the source code size not even the algorithm.
A quick and short answer is that there is a huge difference between the int i,j in C and the my $i and my $j of Perl. A scalar in Perl is not the int of C, but rather a complex data structure. It just happens that you treat it as an integer and Perl gracefully obeys, but you could use them even as strings, or references (functions, arrays, hashes) or even entire objects! And you could do that at any time in your code and Perl would not complain.
Finally Perl being stack-oriented, it has a much slower implementation of loop structures. Even the most simple for(1..1000) {;} will run much slower than the C or Java equivalent. But again, this is the cost for Perl being so much flexible and dynamic.