> > And "" won't be printed before "Done."?
>
> It *will* be printed there, according to the current design. A C is
> *always* called when the iteration leaves the block (whether it's coming
> around again or not). By analogy, C is a terminator, not a
separator.
Darn, we're so close. I understand
Trey Harris wrote:
> So:
>
> for $results.get_next() {
> FIRST { print "Results:"; }
> print $_;
> NEXT { print ""; }
> LAST { print "Done."; }
> } else {
> print "No results.";
> }
>
> Do I have that right?
Yes. Presuming Larry decides in favour of C and C.
Note too that the NAMED
In a message dated Fri, 26 Apr 2002, Damian Conway writes:
> Larry is still considering allowing a C block that would do this.
> It would go inside the loop block.
> [...]
> This will be called a C block. It goes inside the loop block.
> [...]
> This will be called a C block. It goes inside the lo
In a message dated Thu, 25 Apr 2002, Luke Palmer writes:
> > before { ... } # run before first iteration, only if there is at
> >least one iteration
> > after { ... } # run after last iteration, only if there is at least
> > one iteration
> > noloop { ... }
Miko O'Sullivan wrote:
>
> SUMMARY
>
> A proposal for a set of loop structures that simplify code that is based on
> loop iterations.
>
> foreach my $var (@arr) { ... }
> before { ... } # run before first iteration,
> # only if there is at least one iteration
Larry
> foreach my $var (@arr) { ... }
You mean
foreach @arr -> $var {...}
> before { ... } # run before first iteration, only if there is at
>least one iteration
> after { ... } # run after last iteration, only if there is at least
> one iteration
> noloo
(note: this repsonse arrived just in my mailbox, not to the list, but I
thought I'd post my response to the list. -Miko)
> Okay, that's if you can store the results somewhere all at once, but
> so was your example. Iteration objects could be used to optimize for
> the case where you can't (or d
SUMMARY
A proposal for a set of loop structures that simplify code that is based on
loop iterations.
foreach my $var (@arr) { ... }
before { ... } # run before first iteration, only if there is at least
one iteration
between { ... } # run between iterations, not before first or after l
James Ryley wrote:
>
> Hi,
>
> I was wondering if anything ever became of the comments at
> http:[EMAIL PROTECTED]/msg00318.html?
>
> I have an application that would benefit from double interpolation. Of
> course I can work around it, but double interpolation would be so much
> cleaner. Was