#! perl -slw use strict; sub doit { my $in = shift; my $buf; my @out = (); while( length( $in ) ) { $buf = ''; $buf = $buf . chop $in for (0..2); for( 0 .. 3 ) { push @out, ($buf & 64); $buf >>= 6; } } return @out } our $packed = pack 'C*', qw[ 00 16 131 16 81 135 32 146 139 48 211 143 65 20 147 81 85 151 97 1 +50 155 113 215 159 ]; print join ' ', map sprintf( "%02d", $_ ), doit( $packed ); __END__ C:\test>junk10 Argument "ƒÎq" isn't numeric in bitwise and (&) at C:\test\junk10.pl l +ine 12. Argument "øûa" isn't numeric in bitwise and (&) at C:\test\junk10.pl l +ine 12. Argument "ùUQ" isn't numeric in bitwise and (&) at C:\test\junk10.pl l +ine 12. Argument "ô^TA" isn't numeric in bitwise and (&) at C:\test\junk10.pl +line 12. Argument "M-^OË0" isn't numeric in bitwise and (&) at C:\test\junk10.p +l line 12. Argument "ïÆ " isn't numeric in bitwise and (&) at C:\test\junk10.pl l +ine 12. Argument "çQ^P" isn't numeric in bitwise and (&) at C:\test\junk10.pl +line 12. Argument "â^P\0" isn't numeric in bitwise and (&) at C:\test\junk10.pl + line 12. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0 +0 00 00 00 00 00 00 00 00
In reply to Re^2: unpacking 6-bit values
by BrowserUk
in thread unpacking 6-bit values
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |