|
WareLogging, LearningPerl.
|
|
|
|
<[[Brennen]]> Sad as this is to admit, I always forget what a Perl for-loop is supposed to look like, probably since I mostly just use "foreach" to iterate over lists.
|
|
|
|
Anyway, it goes like this:
|
|
|
|
for ($i=1; $i < 100; $i++) {
|
|
# ^init ^while ^increment or whatever
|
|
print "Number $i\n";
|
|
}
|
|
|
|
<[[alan]]> if mem usage doesn't matter you can always just do
|
|
|
|
for my $i (1..99) {
|
|
...
|
|
}
|
|
|
|
but then again, if you meet a C programmer on the street and you don't remember the first form, he may just punch you in the nuts. that could be bad.
|