G'day Rob,

I'm not sure if this helps, but it seems to reproduce what you're describing on a different platform: Cygwin 3.2.0 on Win10. I kept most of your posted code as is; I added some info up front; and, I looped through all of the templates on both 5.32 and 5.34.

$ cat pm_11133064_pack_test.pl use warnings; print "OS: $^O; Perl: $^V;\n", `perl -V:usequadmath`, `perl -V:nvtype`, "\n"; my @templates = qw{d d< d> D D< D>}; for $template (@templates) { print "TEMPLATE: $template\n"; $nv = 2.4; $p = pack $template, $nv; $s = "'$p'"; system $^X, '-wle', "print unpack('H*', $s);"; }
$ perl pm_11133064_pack_test.pl OS: cygwin; Perl: v5.32.0; usequadmath='undef'; nvtype='double'; TEMPLATE: d 3333333333330340 TEMPLATE: d< 3333333333330340 TEMPLATE: d> 4003333333333333 TEMPLATE: D Invalid type 'D' in pack at pm_11133064_pack_test.pl line 11.
$ perl pm_11133064_pack_test.pl OS: cygwin; Perl: v5.34.0; usequadmath='undef'; nvtype='double'; TEMPLATE: d 3333333333330340 TEMPLATE: d< 3333333333330340 TEMPLATE: d> 4003333333333333 TEMPLATE: D Can't find string terminator "'" anywhere before EOF at -e line 1. TEMPLATE: D< Can't find string terminator "'" anywhere before EOF at -e line 1. TEMPLATE: D> Can't find string terminator "'" anywhere before EOF at -e line 1.

— Ken


In reply to Re: pack() returns an unusable string by kcott
in thread pack() returns an unusable string by syphilis

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.