in reply to Better use of for()
If it was a multi-statement block, I would use:print "hello" for 1 .. $messages;
I am not an internals person, so I can not attest to how many more operations testing less than is in comparison to less than or equal to, but I can tell you that premature optimization is often futile and any language where this made a noticeable difference probably isn't worth using.for ( 1 .. $messages ) { ... }
If you are a C style for loop fanatic and you really want to Benchmark the difference, compare it to this:
Cheers - L~R#!/usr/bin/perl -w use strict; my $messages = 10_000; my $limit = $messages + 1; for ( my $i = 1; $i < $limit; $i++ ) { ... }
|
|---|