How to read gz file line by line in Perl6

  • A+

I'm trying to read a huge gz file line by line in Perl6.

I'm trying to do something like this

my $file = 'huge_file.gz'; for $file.IO.lines -> $line {     say $line; } 

But this give error that I have a malformed UTF-8. I can't see how to get this to read gzipped material from the help page or

I want to accomplish the same thing as was done in Perl5:

How can I read a gz file line by line in Perl6?



If you are after a quick solution you can read the lines from the stdout pipe of a gzip process:

my $proc = run :out, "gzip", "--to-stdout", "--decompress", "MyFile.gz"  for $proc.out.lines -> $line {     say $line; }  $proc.out.close; 


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: