in reply to Re^5: Bit handling in Perl
in thread Bit handling in Perl

Dear Monks, I used pack to write a binary file from the csv file and then used vec to compare the bit strings. Interestingly few lines were not getting written as it is in bit file. Some of the 1s were getting written as 0s in those lines. I am not sure why this happens!Also in the binary file the single bit string is getting stored in two lines while the other strings are written in only one line. Can any one please clarify? Thanks!

This is one such line that gave an issue:

111000000111101100110001100000000100010000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000001000011000000000000000000000000000010 001111000100100000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000011111000001100001 000001000000000000000000000000001100000011101100010111011011 001011001011111111110000110111101100100110010000000000101010 100000000010101101100111011101100100010100001100001010000000 001010011011010100000111101000000000100111011001101000010010 100001100110110110001000100000101000111110101100000110011111 100100011000010000100001100010000110100010010000000000101100 100011001001111001110001110010001000110000001000111010000100 000000000000000001000000000000000000000000000000000000000000 10000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000

Replies are listed 'Best First'.
Re^7: Bit handling in Perl
by BrowserUk (Patriarch) on Oct 25, 2014 at 14:22 UTC
    Interestingly few lines were not getting written as it is in bit file. Some of the 1s were getting written as 0s in those lines. I am not sure why this happens!

    That sounds very strange! My best guess is that either your workstation or server is positioned too close to your local turboencabulator, and thus the memory is being affected by stray barescent skor motion produced by the modial interaction of magneto-reluctance and capacitive diractance.

    On the other hand, it could be something wrong with your code, which would be much easier to debug, if I could see it?


    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.

      BrowserUk:

      You should've perhaps included the link showing the video discussion of the magneto-reluctance/capacitive diractance effect: Turboencabulator.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

      I might consider moving my Turboencabulator to the kitchen, thanks for the suggestion! On the other hand, this is the script I used to convert the csv file to binary, which works flawlessly for most rows in my csv file.

      open(A,"6k6.csv"); open(B,">6k6.fp"); binmode B; while(<A>) { if($_=~m/(".*"),(.*)/gi) { $temp=$2; $temp=~tr[,\n][]d; print B "$1".pack 'b*',$temp; print B "\n"; } }

      Then I used vec to write out each bit from the bit string on a separate file which showed me some lines are not converted as it is into binary.

        In order that we might reproduce your problem, we need:

        1. The exact code you are using:

          I'm hoping what you've posted, devoid of strict & warnings and any attempt at error checking, is not the actual code you are using?

          If it is; get your act together and make some attempt to solve your own problems before coming here for help!

        2. A sample input that produces the problem:

          Take this from your real file, but only post a couple of records that do work and one or two that don't. (Don't forget to use <code></code> tags.)

        3. The output produced by your real code when run against the sample input.

          Again, don't forget the code tags.


        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.