targetsmart has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, I just wrote a socket program to(simple client and server) solve a particular purpose, when I faced a problem in it, I used perl debugger to know the values of the variables during execution. I used 'y' to print to the values, but in the case of printing bit vector, the value it prints is a not a readable one. I also used Dumper, but no effect, Is any other way exist to dump the value of a bit vector(without writing a custom sub routine).

Replies are listed 'Best First'.
Re: Dumping bit vector in perl
by BrowserUk (Patriarch) on Oct 18, 2008 at 07:43 UTC
      Thanks, In the mean time I tried using, Bit::Vector::to_Bin it also works.

        You can also save yourself a lot of typing by setting it up as an alias:

        DB<5> =xb x unpack 'b*', xb = x unpack 'b*', DB<6> $_ = 'pqrs' DB<7> xb $_ 0 00001110100011100100111011001110 DB<8> $/ = '1234356577890' DB<9> xb $/ 0 1000110001001100110011000010110011001100101011000110110010101100111 +0110011101100000111001001110000001100

        Be nice if you could put a list of aliases somewhere that would cause them to be loaded each time the debugger is started. I know there is a "db profile", but I can't remember any specifics. It must be in teh docs somewhere?


        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.
Re: Dumping bit vector in perl
by JavaFan (Canon) on Oct 18, 2008 at 07:39 UTC
    Not that I know. The reason is, Perl doesn't know about bit vectors. Perl knows about strings, numbers and references. What we call a "bit vector" is really a string (or a number) that is used in a certain way.