Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

if you treat this everyday, the better way is to create a template:

use strict; use warnings; use Convert::Binary::C; use Data::Dumper; use Data::Hexdumper; my $c = Convert::Binary::C->new(ByteOrder => 'BigEndian', LongSize => + 8)->parse(<<'ENDC'); struct one8 { unsigned long a; }; struct two4 { unsigned int a; unsigned int b; }; ENDC my $data = "\x91\x34\x33\x90\x81\x32\x31\x80"; print hexdump($data); print "BigEndian\n"; my $u1 = $c->unpack('one8', $data); print Dumper $u1; my $u2 = $c->unpack('two4', $data); print Dumper $u2; print "LittleEndian\n"; $c->tag('one8', ByteOrder => 'LittleEndian'); $c->tag('two4', ByteOrder => 'LittleEndian'); my $u3 = $c->unpack('one8', $data); print Dumper $u3; my $u4 = $c->unpack('two4', $data); print Dumper $u4;

I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

In reply to Re: Unpacking byte stream long/quad little/big endian fields by xiaoyafeng
in thread Unpacking byte stream long/quad little/big endian fields by GrandFather

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (6)
    As of 2021-04-23 06:15 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found