Please read Writeup formatting tips. Particularly, please wrap your code samples in 'code tags' thus:

<code> ## Your code goes here </code>

Your example will then display as:

#!/fs/COTS/gnu/bin/AIX/perl $raw = pack 'H*', '00000034000031b110191403b8811bb1366e4'; print for reverse unpack 'dCCVV', reverse $raw

Now, the reason you are not getting the same results is because no linefeeds are being produced, so all the numbers are being abutted. There are three ways to fix that problem.

  1. Append the newline character to the end of each thing printed:
    #!/fs/COTS/gnu/bin/AIX/perl $raw = pack 'H*', '00000034000031b110191403b8811bb1366e4'; print $_, "\n" for reverse unpack 'dCCVV', reverse $raw
  2. Add -l to the shebang line: (This is what I did.)
    #!/fs/COTS/gnu/bin/AIX/perl -l $raw = pack 'H*', '00000034000031b110191403b8811bb1366e4'; print for reverse unpack 'dCCVV', reverse $raw
  3. If you are using perl 5.10, then use say instead of print:
    #!/fs/COTS/gnu/bin/AIX/perl $raw = pack 'H*', '00000034000031b110191403b8811bb1366e4'; say for reverse unpack 'dCCVV', reverse $raw

BTW: Stupid as it is, some people will get upset with you if you continue to write "PERL". You should use 'Perl' or 'perl' (the first to indicate the language, the second to indicate the interpreter (load module)) in order to avoid that.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^5: HEX to floating point by BrowserUk
in thread HEX to floating point by Spooky

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.