Totally untested Partly tested; ignoring any index if it is present as the spec doesn't mention it; and making no attempt to present the contain data in any useful way since I don't know what it represents; but it should be pretty close:

#! perl -slw use strict; my $fname = $ARGV[ 0 ]; open IN, '<:raw', $fname or die $!; read( IN, my $header, 31 ); my( $sig, $ver, $iOff, $iLen, $reads, $hLen, $kLen, $flows, $fmt ) = u +npack 'a4 N Q N N n n n C', $header; print "sig: $sig ver:$ver iOff:$iOff iLen:$iLen reads:$reads hLen:$hLe +n kLen:$kLen flows:$flows fmt:$fmt"; read( IN, my $varHead, $hLen - 31 ); my( $flowchars, $keySeq ) = unpack "a$flows a$kLen", $varHead; print "flowchars: $flowchars\nkeySeq:$keySeq\n"; for my $read ( 1 .. $reads ) { my $buffer; read( IN, $buffer, 16 ); my( $hLen, $nLen, $bases, $cqLeft, $cqRight, $caLeft, $caRight ) = + unpack 'n n N n n n n', $buffer; read( IN, $buffer, 8*int( ( $nLen + 7 ) / 8 ) ); my $name = unpack "a$nLen", $buffer; read( IN, $buffer, 2*$flows ); my @signal = unpack "n$flows", $buffer; read( IN, $buffer, $bases ); my @posns = unpack "C$bases", $buffer; read( IN, $buffer, $bases ); my @scores = unpack "C$bases", $buffer; read( IN, $buffer, 8*int( ( 4*$bases + 7 ) /8 ) ); ## discard padd +ing ## do something useful with data here. print "Name: $name\nSignal: [ @signal ]\nPosns: [ @posns ]\nScores +: [ @scores ]\n"; last if eof( IN ); }

Output from the partial file in the OP:


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". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: Convert numbers from a binary file to texts (Now partly tested). by BrowserUk
in thread Convert numbers from a binary file to texts by bestfa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.