Hi All,

Yes, I know there are other ways to read a file.  I
have a specific reason for using `read`.

How do I properly turn a Buf into a Str (all the bytes will
have been tested to make sure they are printable first)?

$ p6 'my $fh=open "/home/linuxutil/WhoIsMySub.pl6", :r; my Buf $f = $fh.read(200); $fh.close; say "<" ~ $f.Stringy ~ ">";'

Cannot use a Buf as a string, but you called the Stringy method on it
  in block <unit> at -e line 1


This isn't working either

$ p6 'my $fh=open "/home/linuxutil/WhoIsMySub.pl6", :r; my Buf $f = $fh.read(200); $fh.close; say "<" ~ @$f ~ ">";'

<35 33 47 117 115 114 47 98 105 110 47 101 110 118 32 112 101 114 108 54 10 10 115 117 98 32 102 40 41 32 123 32 112 117 116 32 38 63 82 79 85 84 73 78 69 46 103 105 115 116 59 32 125 59 10 10 115 117 98 32 97 98 99 32 40 41 32 123 10 32 32 32 32 115 97 121 32 34 84 104 105 115 32 115 117 98 114 111 117 116 105 110 101 39 115 32 73 68 32 105 115 32 34 44 32 102 59 10 32 32 32 32 112 114 105 110 116 32 34 92 110 34 59 10 10 32 32 32 32 38 63 82 79 85 84 73 78 69 46 103 105 115 116 32 126 126 32 109 47 39 32 39 40 46 42 63 41 39 32 39 92 40 47 59 32 10 32 32 32 32 109 121 32 36 83 117 98 78 97 109 101 32 61 32 36 48 59 10 32 32 32 32 115 97 121 32 34 84 104 105>


Many thanks,
-T

Reply via email to