Binish A R wrote:
> Binish A R wrote:
> 
>> I've a bit string something like
>> 1100110100111
>> which is the bit representation of A and B together.
>>
>> How can I use unpack/pack to get this characters back?
>
> oops .... small mistake .. the bit representation for AB together is
> 0100000101000010.
> 
> Going thru perlpacktut, I tried the following
> 
> perl -le '$d = pack('B8' x 2, "0100000101000010"); print $d'
> 
> But its giving me only A ...
> It should give AB right?

$ perl -le' $_ = unpack q/B*/, q/AB/; print'
0100000101000010
$ perl -le' $_ = pack q/B*/, q/0100000101000010/; print'
AB


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to