t; Hi All,
>
> When reading a text file
> https://docs.perl6.org/routine/lines
> seems pretty straight forward.
>
> Question: How do I tell when I when I have
> reached the EOF (End Of File)?
>
> Many thanks,
>
0/9/18 1:02 AM, ToddAndMargo via perl6-users wrote:
> > Hi All,
> >
> > When reading a text file
> > https://docs.perl6.org/routine/lines
> > seems pretty straight forward.
> >
> > Question: How
Stringify iterates the Seq, printing all the
lines.
The second call to .lines() returns nothing because you're now at eof,
no more lines.
Note the Seq that .lines returns itself is lazy. It doesn't
(necessarily) have all the lines, just the capability to get them.
As you iterate the Se
ing a text file
> > > https://docs.perl6.org/routine/lines
> > > seems pretty straight forward.
> > >
> > > Question: How do I tell when I when I have
> > > reached the EOF (End Of File)?
> > >
> > > M
On Tue, Oct 9, 2018 at 8:31 AM Curt Tilmes wrote:
>
> On Tue, Oct 9, 2018 at 9:27 AM Laurent Rosenfeld via perl6-users
> wrote:
>>
>> This:
>> my $f = $fh.lines;
>> will slurp all the lines into $f (but you can still access the individual
>> items with something like $f[4]).
>
>
> Is that true?
Yes, you're right, it is a Seq. I was trying to be pedagogical, but
probably wasn't very accurate. It is a Seq, and the "slurping" will be lazy.
Le mar. 9 oct. 2018 à 15:30, Curt Tilmes a écrit :
> On Tue, Oct 9, 2018 at 9:27 AM Laurent Rosenfeld via perl6-users <
> perl6-users@perl.org> wrote
On Tue, Oct 9, 2018 at 9:27 AM Laurent Rosenfeld via perl6-users <
perl6-users@perl.org> wrote:
> This:
> my $f = $fh.lines;
> will slurp all the lines into $f (but you can still access the individual
> items with something like $f[4]).
>
Is that true? I supposed that it would hold the Seq as a
:02 AM, ToddAndMargo via perl6-users wrote:
> > > Hi All,
> > >
> > > When reading a text file
> > > https://docs.perl6.org/routine/lines
> > > seems pretty straight forward.
> > >
> > > Question: How do I
ll the
lines.
The second call to .lines() returns nothing because you're now at eof, no
more lines.
Note the Seq that .lines returns itself is lazy. It doesn't (necessarily)
have all the lines, just the capability to get them.
As you iterate the Seq, it pulls in all the lines.
Curt
t; Hi All,
>
> When reading a text file
> https://docs.perl6.org/routine/lines
> seems pretty straight forward.
>
> Question: How do I tell when I when I have
> reached the EOF (End Of File)?
>
> Many thanks,
> -T
Plea
How do I tell when I when I have
reached the EOF (End Of File)?
Many thanks,
-T
On 10/9/18 4:38 AM, Laurent Rosenfeld via perl6-users wrote:
The eof method of the IO::Handle class returns True if you exhausted
the contents of the handle, but you generally don't need to use t
https://docs.perl6.org/routine/lines
> > seems pretty straight forward.
> >
> > Question: How do I tell when I when I have
> > reached the EOF (End Of File)?
> >
> > Many thanks,
> > -T
>
> Please expand the question to include `read` and `readchars`.
>
--
Fernando Santagata
Le mar. 9 oct. 2018 à 10:03, ToddAndMargo via perl6-users
mailto:perl6-users@perl.org>> a écrit :
Hi All,
When reading a text file
https://docs.perl6.org/routine/lines
seems pretty straight forward.
Question: How do I tell when I when I have
reached the EOF (
The eof method of the IO::Handle class returns True if you exhausted the
contents of the handle, but you generally don't need to use that, since
something like:
for 'input.txt'.IO.lines -> $line {
# Do something with $line
}
will gracefully handle ends of files for you wit
On 10/9/18 1:02 AM, ToddAndMargo via perl6-users wrote:
Hi All,
When reading a text file
https://docs.perl6.org/routine/lines
seems pretty straight forward.
Question: How do I tell when I when I have
reached the EOF (End Of File)?
Many thanks,
-T
Please expand the question to include
Hi All,
When reading a text file
https://docs.perl6.org/routine/lines
seems pretty straight forward.
Question: How do I tell when I when I have
reached the EOF (End Of File)?
Many thanks,
-T
16 matches
Mail list logo