OK, here's the deal:
Src box:
Prod server running FreeBSD 4.9-STABLE, perl 5.005_03
Tgt box:
Linux (RH FC3) kernel 2.6.9, perl v5.8.5

Src is sending concatenated long doubles:
$s.= pack('D',$count{$ip}{$x}{in}); $s.= pack('D',$count{$ip}{$x}{out}); $s.= pack('D',int $count{$ip}{$x}{in}); $s.= pack('D',int $count{$ip}{$x}{out}); $s.= pack('D',int $count{$ip}{$x}{inpackets}); $s.= pack('D',int $count{$ip}{$x}{outpackets});
This cannot be changed as many boxes depend already on output.

Tgt unpacks:
unpack('d',substr($msg,$ptr,8)); unpack('d',substr($msg,$ptr+8,8)); unpack('d',substr($msg,$ptr+16,8)); unpack('d',substr($msg,$ptr+24,8));
Obviously sometimes the incoming num is too big and corruption occurs. Perldoc on tgt says:

D A long double-precision float in the native format. (Long doubles are available only if your system supports long double values _and_ if Perl has been compiled to support those. Causes a fatal error otherwise.)

Tgt box has not been recompiled.
Qn: will RH FC3 support long doubles if we try to re-compile?
We would prefer not to re-compile if possible, as tgt is prod box also.
Is it possible to unpack using a different method eg unpack each block of 8 bytes as 2 sets of 4, then re-combine?
Thx for any help
Chris

In reply to Value packed as 'D', how to unpack not using 'D'? by chrism01

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.