CGI Perl Question:
Download Job Interview Questions and Answers PDF
Packing and Unpacking.
Hi, I want to get output as 0x23400000345....
in the below example How to get?
i tried out, but unable to get the answer
$r=0x234;
$t=0x345;
$y=pack(L L,$t,$r);
$x1=unpack(L!,pack(P,$y));
printf("\nThe value is $x1");
I didnt get constant output?
Answer:
use the following code.
<code>
use bigint;
my $r = 0x234;
my $t = 0x345;
my $x1 = $r << 32 | $t;
print $x1->as_hex;
</code>
<code>
use bigint;
my $r = 0x234;
my $t = 0x345;
my $x1 = $r << 32 | $t;
print $x1->as_hex;
</code>
Download CGI Perl Interview Questions And Answers
PDF
Previous Question | Next Question |
Write an expression or Perl script to identify the entered IP address is valid or not? | How to sort dates in Perl? |