On Apr 16, 2004, at 7:19 AM, Simon Cozens wrote:

I'll bet you the actual most *common* use of modulus is:

    until ( my ($percent_done=done()) == 100 ) {
        do_work();
        print $percent_done,"\n" unless $percent_done % 10;
    }

And I'll bet it's something like this:


for my $i (0..$#thingies) {
    my $css_class = $i % 2 ? 'blue' : 'yellow';
        print "<tr class="$css_class"><td>$thingies[$i]</td></tr>\n";
}

Pretty useful, actually.

Regards,

David



Reply via email to