Help for this page

Select Code to Download


  1. or download this
    # find sum of first 100 digits
    my $sum = 0;
    for my $i (0 .. 99) {
        $sum += $i;
    }
    
  2. or download this
    # print lines from a file handle and stop when done
    while (my $line = <FILE>) {
        print $line;
    }
    
  3. or download this
    for (0 .. 99) {
        print "$_\n";
        last if $_ == 42;
    }
    
  4. or download this