I recommend that you pass the value as an argument
What I was wanting to do was to pass the actual string as the argument.
It didn't really occur to me that doing that would be such a problem. I thought that people would be able to show me that this could be achieved with little fuss. (I was wrong ;-)
What I was interested in doing is easily demonstrated in the following script, where I've used the code that you supplied, but have replaced the last line with 2 lines:
use strict;
use warnings;
my $template = 'D<';
my $nv = 2.4;
my $p = pack $template, $nv;
# I'm running this script on perl-5.34.0
# with nvtype of 'long double'.
# I want to see the result of perl-5.34.0
# with nvtype of 'double' unpacking $p :
my $perl = "C:/perl-5.34.0/bin/MSWin32-x64-multi-thread/perl.exe";
system $perl, '-wle', 'print unpack("H*", $p)';
If that DWIMmed, it would output :
9a999999999999990040000000000000
but, of course, all that it emits is the warning:
Use of uninitialized value $_ in print at -e line 1.
Sure, I could take a leaf out of your book and alter my last line to:
system $perl, '-wle', 'print $ARGV[0]', unpack('H*', $p);
But that
unpack('H*', $p) is being evaluated by the 'long double' build of perl.
I wanted to see what happened when it was evaluated by my 'double' build of perl-5.34.0.
I've since accomplished this by other means.
Cheers,
Rob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.