[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Only read the first 30 lines of a file?



At 23:02 1999-04-22 -0400, Chris Nandor wrote:
>At 20.54 -0400 1999.04.22, Chilton Webb wrote:
>>In MacPerl, what's a good way to read only the first 30 lines of a file?
>>I have a program that looks for certain info in several thousand files,
>>and these files are hundreds of k long. The info, however, is typically
>>in the first 10 or 20 lines. How can I do this?
...

>for (0..30) {
>  $data .= <FILE>;
>}

1..30, surely? Both endpoints are included in the range,
according to "Programming perl".

Peter.


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org