in reply to pack() returns an unusable string
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: pack() returns an unusable string
by syphilis (Archbishop) on May 27, 2021 at 13:50 UTC |