in reply to Re^2: pack() returns an unusable string
in thread pack() returns an unusable string
And here's a version with Data::Dumper and some config vars that also works.
#!/usr/bin/perl -l use strict; # https://perlmonks.org/?node_id=11133064 use warnings; my $template = 'd<'; my $nv = 2.4; $nv = 4135; # NOTE errors for this number my $p = pack $template, $nv; use Data::Dumper; $Data::Dumper::Terse = $Data::Dumper::Useqq = 1; my $s = Dumper $p; print ">$s<\n"; system $^X, '-wle', "use strict; print unpack('H*', $s);";
Outputs:
>"\0\0\0\0\0'\260\@" < 000000000027b040
note that it adds a newline, but perl doesn't care.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: pack() returns an unusable string
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 |