The equivalent in Perl is#include <stdio.h> int main(void) { int i; for ( i = 0; i < 10; i++ ) { printf ( "%d", i ); } }
No variable declarations, a friendlier print statement, and no mysterious 'cargo-cult' include thingy.for ( $i = 0; $i < 10; $i++ ) { print $i; }
Don't get me wrong -- I have programmed in C since the early 80's and I love the language. But Perl takes care of lots of the underlying stuff (how many times did I write fopen(), fread() and fclose() statements I wonder). That's why I think Perl is a better choice than C.
Perl can be a heavyweight language, but it can also be lightweight. To use the car analogy, C is a bit like the British Triumph, a little finicky, but piles of power and cornering. Pascal is a bit like a Pinto or a CV5 stuck in second gear. Perl is like a Porsche or a Lexus, nimble yet powerful.
--t. alex
"Mud, mud, glorious mud. Nothing quite like it for cooling the blood!"
--Michael Flanders and Donald Swann
In reply to Re: Re: Learning Perl as a First (programming) language
by talexb
in thread Learning Perl as a First (programming) language
by japhif
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |