in reply to do {$i++} until vs. $i++ until
This is documented in perlsyn:
The while and until modifiers have the usual "while loop" semantics (conditional evaluated first), except when applied to a do-BLOCK (or to the deprecated do-SUBROUTINE statement), in which case the block executes once before the conditional is evaluated. This is so that you can write loops like:
do { $line = <STDIN>; ... } until $line eq ".\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: do {$i++} until vs. $i++ until
by hipowls (Curate) on Mar 25, 2008 at 07:32 UTC | |
by ikegami (Patriarch) on Mar 25, 2008 at 08:36 UTC | |
by hipowls (Curate) on Mar 25, 2008 at 09:17 UTC |
In Section
Seekers of Perl Wisdom