Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Unpack an 8 bit unsigned char matrix (fixed)

by BrowserUk (Pope)
on Jul 15, 2013 at 22:06 UTC ( #1044462=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Unpack an 8 bit unsigned char matrix
in thread Unpack an 8 bit unsigned char matrix

A quick (not binary, but same difference) demo:

#! perl -slw use strict; use Data::Dump qw[ pp ]; sysread( DATA, my $buffer, 80 ) or die $!; my @matrixX10 = map[ unpack 'C*', $_ ], unpack '(a10)*', $buffer; pp\@matrixX10; my @matrixX5 = map[ unpack 'C*', $_ ], unpack '(a5)*', $buffer; pp\@matrixX5; __DATA__ 1234567890123456789012345678901234567890123456789012345678901234567890 +1234567890

Produces:

C:\test\primes>..\junk94 [ [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], [49, 50, 51, 52, 53, 54, 55, 56, 57, 48], ] [ [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], [49, 50, 51, 52, 53], [54, 55, 56, 57, 48], ]

Broken code replaced above:


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re^3: Unpack an 8 bit unsigned char matrix (fixed)
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1044462]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-08-28 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls