Re: Reading X lines at a time

Xavier Noria <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
On May 3, 2004, at 12:34, Jose Alves de Castro wrote:

> I was thinking about something I could use "HERE":
>
> while (HERE) {
>   # do something with $_
> }

What about a foreach loop:

     use Perl6::Slurp;

     $X = 4;
     $regexp = '.*\n?' x $X;

     foreach $Xlines (slurp 'foo.txt', { irs => qr/$regexp/ }) {
         # ...
     }

-- fxn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.