Trey Harris wrote: > So: > > for $results.get_next() { > FIRST { print "Results:<BR>"; } > print $_; > NEXT { print "<HR>"; } > LAST { print "Done."; } > } else { > print "No results."; > } > > Do I have that right?
Yes. Presuming Larry decides in favour of C<FIRST> and C<else>. Note too that the NAMED blocks are order-and-position independent, so (whilst I agree that the order you wrote them was clearest) you could also have written (with exactly the same effect): for $results.get_next() { FIRST { print "Results:<BR>"; } NEXT { print "<HR>"; } LAST { print "Done."; } print $_; } if you were inclined, or: for $results.get_next() { LAST { print "Done."; } print $_; NEXT { print "<HR>"; } FIRST { print "Results:<BR>"; } } if you were insane. ;-) > And "<HR>" won't be printed before "Done."? It *will* be printed there, according to the current design. A C<NEXT> is *always* called when the iteration leaves the block (whether it's coming around again or not). By analogy, C<NEXT> is a terminator, not a separator. That's necessary because C<NEXT>s will be mainly used to do synchronous clean-up on lexical values: for @filenames { my $fh = open $_ or die; NEXT { close $fh } ... } Damian