>>>>> ""Charles" == "Charles K Clarkson" <[EMAIL PROTECTED]> writes:
"Charles> Dr.Ruud wrote:
"Charles> : Bryan R Harris schreef:
"Charles> :
"Charles> :: for (1..9) { <>; }
"Charles> :
"Charles> : while (<>)
"Charles> : {
"Charles> : next if $. < 10;
"Charles> : ...
"Charles> : }
"Charles> So a billion line file will require a billion tests
"Charles> instead of 9. That doesn't seem like a good idea.
If the cost of comparing $. to 10 is significant compared to the
rest of your loop, you're in the wrong programming language.
However, having said that:
my $meat;
$meat = sub {
$meat = sub { real body of loop here } if $. >= 9;
};
$meat->() while <>;
There. Happy? No more tests. And now you'll complain about the
subroutine call. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>