On 10/9/18 5:42 AM, Fernando Santagata wrote:
The answer Laurent Roseenfeld gave you works for read and readchars as well.
Save the following lines in a file and run it (try and change .read into
.readchars too); it will output a series of 10-byte long Buf[uint8]s,
until it reaches the end of fi
Le mar. 9 oct. 2018 à 14:49, ToddAndMargo via perl6-users
mailto:perl6-users@perl.org>> a écrit :
On 10/9/18 5:42 AM, Fernando Santagata wrote:
> The answer Laurent Roseenfeld gave you works for read and
readchars as well.
> Save the following lines in a file and run it (try an
On 10/9/18 6:22 AM, Curt Tilmes wrote:
On Tue, Oct 9, 2018 at 8:49 AM ToddAndMargo via perl6-users
mailto:perl6-users@perl.org>> wrote:
I am not getting anywhere with `.lines`. Read the whole thing in the
first line.
$ p6 'my $fh=open "/home/linuxutil/WhoIsMySub.pl6", :r; whil
That isn't the syntax for a loop local variable in Perl 6.
You are trying to use the Perl 5 syntax, which is not going to work in Perl 6
This is the Perl 5 code you are trying to write
while( my $f = readline $fh ){ say "$f\n"}
Which actually would turn into the following by Perl 5 compiler
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
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]).
So you don't want to use this in a while loop, since everything will be
consumed during the first loop iteration. Either use a for loop to process
the lines one by o
On Tue, Oct 9, 2018 at 8:49 AM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:
>
> I am not getting anywhere with `.lines`. Read the whole thing in the
> first line.
>
> $ p6 'my $fh=open "/home/linuxutil/WhoIsMySub.pl6", :r; while my $f =
> $fh.lines { say "$f\n"}; $fh.close;'
>
.l
On 10/9/18 5:42 AM, Fernando Santagata wrote:
The answer Laurent Roseenfeld gave you works for read and readchars as well.
Save the following lines in a file and run it (try and change .read into
.readchars too); it will output a series of 10-byte long Buf[uint8]s,
until it reaches the end of f
On 10/9/18 5:03 AM, ToddAndMargo via perl6-users wrote:
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
The answer Laurent Roseenfeld gave you works for read and readchars as well.
Save the following lines in a file and run it (try and change .read into
.readchars too); it will output a series of 10-byte long Buf[uint8]s, until
it reaches the end of file.
#!/usr/bin/env perl6
given $*PROGRAM-NAME.IO
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 (End Of Fil
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 without you having to d
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 `
15 matches
Mail list logo