On Thu, 19 Aug 2004 10:38:48 -0500, Dan Hursh <[EMAIL PROTECTED]> wrote:
> while another $foo {..}
>
> It's 5 characters too many, but it works.
>
> Dan

At this point, you may as well use C<.records> (think C<$/> -- record
separator):

   for $foo.records { ... }

Then it'd be a small step to allow:

   for $foo.records :sep"," { ... }
                 --or--
   for $foo.records(",") { ... }

to override C<$/>. Ideally, you'd have C<.lines> to use as well. It's
not nearly general enough, but in many (most?) cases it would provide
the wanted behavior.

The trouble is that using a for loop builds a list in memory, which
can be troublesome. But I suppose a singular version could be used to
act as an iterator:

   while my $rec = $foo.record :sep"\n" { ... }
   while my $line = $foo.line { ... }

Or maybe one method could be used both ways, depending on whether it's
called in list or scalar context. But you wouldn't get the implicit
assignment to C<$_>.

--
matt

Reply via email to