in reply to Re: pack() returns an unusable string
in thread pack() returns an unusable string
That outputs the following (which does, at least, contain an "@"):# test.pl use warnings; use Devel::Peek; $template = 'D<'; $nv = 2.4; $p = pack $template, $nv; $s = "'$p'"; Dump $s; system $^X, '-wle', "print unpack('H*', $s);";
But if I change the value of $nv to 2.4e100, I get:C:\_32\pscrpt>perl test.pl SV = PV(0x4bcf98) at 0x571248 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x4b7e88 "'\232\231\231\231\231\231\231\231\0@\0\0\0\0\0\0'"\0 CUR = 18 LEN = 20 Can't find string terminator "'" anywhere before EOF at -e line 1.
Interestingly, changing the value to 3.1e-100 results in a different warning:C:\_32\pscrpt>perl test.pl SV = PV(0x3ecf98) at 0x383348 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x3e7e88 "'\vL\177v\257zb\206\264>\0\0\0\0\0\0'"\0 CUR = 18 LEN = 20 Can't find string terminator "'" anywhere before EOF at -e line 1.
Perhaps something to do with the internal double quote.C:\_32\pscrpt>perl test.pl SV = PV(0x26cf98) at 0x5311f8 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x267e88 "'9\302\271\243\"\211\224\255\264>\0\0\0\0\0\0'"\0 CUR = 18 LEN = 20 Use of uninitialized value $_ in print at -e line 1.
Is there some way to pass the string returned by pack() to that system command ?C:\_32\pscrpt>perl test.pl SV = PV(0x38cf98) at 0x4c51b8 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x387e88 "'\245^,\356\266\0208\270\266>\0\0\0\0\0\0'"\0 CUR = 18 LEN = 20 Can't find string terminator "'" anywhere before EOF at -e line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: pack() returns an unusable string
by tybalt89 (Monsignor) on May 27, 2021 at 01:34 UTC | |
by syphilis (Archbishop) on May 27, 2021 at 02:39 UTC | |
by tybalt89 (Monsignor) on May 27, 2021 at 03:16 UTC | |
by syphilis (Archbishop) on May 27, 2021 at 06:06 UTC | |
by tybalt89 (Monsignor) on May 27, 2021 at 13:26 UTC | |
|
Re^3: pack() returns an unusable string
by tybalt89 (Monsignor) on May 27, 2021 at 01:11 UTC |