I am reading a file with
my @titles = @*ARGS[1].slurp;
and then just
@titles.say
I am very fond of such a quick way of reading a file instead of every time
dance of "$fh = open...; <$fh>"
a problem is - my file contains characters /[\x80-\xFF]/, and all that
characters get replaced with the space.
There is something with binmode, encoding, unicode, but I just want get
binary stream out of my file.
Is it possible with "slurp"?
Another problem:
pugs -we "@*ARGS[0].say" foobarfluffy
outputs foobarfluffy as expected, whereas
pugs -we "@*ARGS[0].say" -foobarfluffy
outputs -f
TIA,
Vadim
> Is it possible with "slurp"?
What you want should be something like
"filename".slurp(:raw)
if Perl 6 is going to follow Perl6::Slurp according to Damian's CPAN
module. But it is not supported yet by Pugs, I think. Currently,
"slurp" accepts an only parameter (a filename or a handle). By now,
this seems to works:
open("filename", :raw).slurp()
Not so short, but at least it is there.
Regards,
Adriano.