Hi All!

Question: I am using `read` to read the first 400 bytes of an unknown file (could be a binary file). The 400 bytes go into a variable
of type "Buf".  This is not a string.

p6 'my $fh=open "/home/linuxutil/To", :r; my Buf $f = $fh.read( 400 ); $fh.close;'

Now in $f, I want to look at each byte one at a time for a
bitwise pattern using bitwise AND.

How do I address each byte?

`dd` seems to get me the information I need, but it prints it:

$ p6 'my $fh=open "/home/linuxutil/To", :r; my Buf $f = $fh.read( 10 ); $fh.close; dd $f;'

    Buf[uint8] $f = Buf[uint8].new(87,111,114,100,80,114,111,0,0,0)

An array of bytes would be great.

Many thanks,
-T

Reply via email to