Maybe the following helps a bit clarifying what's what:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Hexdumper qw(hexdump);
use integer;
my $Rm = '0xAAAAAAAA';
my $Rb = hex $Rm;
my $Rc = pack 'l', $Rb;
my $Rd = unpack 'l', $Rc;
my $Re = $Rd >> 31;
my $Rx = pack 'l', $Re;
print 'Rm: ', hexdump( $Rm, { suppress_warnings => 1 } );
print 'Rb: ', hexdump( $Rb, { suppress_warnings => 1 } );
print 'Rc: ', hexdump( $Rc, { suppress_warnings => 1 } );
print 'Rd: ', hexdump( $Rd, { suppress_warnings => 1 } );
print 'Re: ', hexdump( $Re, { suppress_warnings => 1 } );
print 'Rx: ', hexdump( $Rx, { suppress_warnings => 1 } );
printf "Rb = 0x%x\t Re = 0x%x\n",$Rb, $Re;
which displays
Rm: 0x0000 : 30 78 41 41 41 41 41 41 41 41 00 00 00 00 00 00 : 0xAAA
+AAAAA......
Rb: 0x0000 : 32 38 36 33 33 31 31 35 33 30 00 00 00 00 00 00 : 28633
+11530......
Rc: 0x0000 : AA AA AA AA 00 00 00 00 00 00 00 00 00 00 00 00 : .....
+...........
Rd: 0x0000 : 2D 31 34 33 31 36 35 35 37 36 36 00 00 00 00 00 : -1431
+655766.....
Re: 0x0000 : 2D 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : -1...
+...........
Rx: 0x0000 : FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 : .....
+...........
Rb = 0xaaaaaaaa Re = 0xffffffffffffffff
Krambambuli
---
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.