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