packing and unpacking problem

rag84dec's Avatar, Join Date: Jul 2007
Go4Expert Member
Hi,
I want to get output as 0x23400000345....in the below example
how to get??..i tried out the following but unable to get the anser ....

please help...


$r=0x234;
$t=0x345;

$y=pack('L L',$t,$r);
$x1=unpack('L!',pack('P',$y));
printf("\nThe value is $x1");
0
ungalnanban's Avatar, Join Date: Feb 2010
Go4Expert Member
I workout with your program but its not giving constant output.

each time it giving different output.
0
ungalnanban's Avatar, Join Date: Feb 2010
Go4Expert Member
Code:
 use bigint;

my $r = 0x234;
my $t = 0x345;

my $x1 = $r << 32 | $t;

print $x1->as_hex;    ###  0x23400000345
You can use the above code.