I can confirm what Yary is seeing with respect to the "lines(:!chomp)"
call. Below I can print things out on a single line (using "print"),
but the use of "print" or "put" appears to be controlling, not
manipulating the "chomp" option of "lines()".

> mbook:~ homedir$ cat abc_test.txt
line aardvark
line balloon
line catamaran
> mbook:~ homedir$ perl6 -e 'for lines(chomp=>True) {.uc.perl.print; print ", 
> ";}' abc_test.txt
"LINE AARDVARK", "LINE BALLOON", "LINE CATAMARAN",
>mbook:~ homedir$ perl6 -e 'for lines(chomp=>False) {.uc.perl.print; print ", 
>";}' abc_test.txt
"LINE AARDVARK", "LINE BALLOON", "LINE CATAMARAN",
> mbook:~ homedir$ perl6 -e 'for lines(chomp=>True) {.uc.perl.put; print ", 
> ";}' abc_test.txt
"LINE AARDVARK"
, "LINE BALLOON"
, "LINE CATAMARAN"
,
> mbook:~ homedir$ perl6 -e 'for lines(chomp=>False) {.uc.perl.put; print ", 
> ";}' abc_test.txt
"LINE AARDVARK"
, "LINE BALLOON"
, "LINE CATAMARAN"
,
> mbook:~ homedir$ perl6 -v
This is Rakudo version 2019.07.1 built on MoarVM version 2019.07.1
implementing Perl 6.d.

HTH, Bill.



On Sun, Oct 20, 2019 at 4:40 PM yary <not....@gmail.com> wrote:
>
> It seems that *ARGFILES is opened with :chomp=True, so adding :!chomp to the 
> lines call is too late.
>
> $ perl6 -e "say 11; say 22; say 33;" | perl6 -e '.say for lines(:chomp)'
>
> 11
>
> 22
>
> 33
>
> $ perl6 -e "say 11; say 22; say 33;" | perl6 -e '.say for lines(:!chomp)'
>
> 11
>
> 22
>
> 33
>
>
> -y

Reply via email to