Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Handling binary

by flexvault (Monsignor)
on Sep 12, 2015 at 13:52 UTC ( [id://1141775] : note . print w/replies, xml ) Need Help??


in reply to Handling binary

Welcome G109B,

I think you will find it easier to use binary strings for your project. To get you started:

perl -e '$h=pack("H*","139686DA20C1");$b=unpack("B*",$h);print length( +$b)," $b\n";'

Then use 'substr' to get 5 binary digits at a time.

while( $b ) { print substr($b,0,5,""); }
Do the opposite to build your blob.

Why are you using Base 5, when the rest of the world uses binary?

Regards...Ed

"Well done is better than well said." - Benjamin Franklin