C:\>perl -wle "print unpack 'H*', pack 'D', 2.4;" 9a999999999999990040000000000000 #### C:\>perl -wle "print unpack 'H*', pack 'D', 2.4;" 00989999999999990040000000000000 #### use warnings; $template = 'D<'; $nv = 2.4; $p = pack $template, $nv; $s = "'$p'"; # Now pass $p to the 'double' build of perl. $double_perl = "C:/perl-5.34.0/bin/MSWin32-x64-multi-thread/perl.exe"; system $double_perl, '-wle', "print unpack('H*', $s);"; #### use warnings; $p = pack("D", 2.4); open WR, '>', 'packstr.txt' or die "Opening: $!"; binmode(WR); print WR $p; close WR or die "Closing: $!"; #### use warnings; open RD, '<', 'packstr.txt' or die "Opening: $!"; binmode(RD); $p = ; close RD or die "Closing: $!"; print unpack("H*", $p);