WalaWiki content from p1k3.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
590 B

  1. WareLogging, LearningPerl.
  2. <[[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.
  3. Anyway, it goes like this:
  4. for ($i=1; $i < 100; $i++) {
  5. # ^init ^while ^increment or whatever
  6. print "Number $i\n";
  7. }
  8. <[[alan]]> if mem usage doesn't matter you can always just do
  9. for my $i (1..99) {
  10. ...
  11. }
  12. 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.