Hello Gurus,
i have a long integer which i want to convert to hexadecimal. When i try to convert the integer to hexadecimal beyond certain digits, it gives the value as 'ffffff'
#!/usr/local/bin/perl
$intval = 3143230627;
$hexval = sprintf ("%x", $intval);
printf "value of $intval : $hexval \n";
$intval = 123143230627;
$hexval = sprintf ("%x", $intval);
printf "value of $intval : $hexval \n";
The output
> ./t.pl
value of 3143230627 : bb59e4a3
value of 123143230627 : ffffffff
any help will be appreciated.
Note: would like to use inbuilt functions or modules, because any other module installation will be unacceptable to the project.
cheers,
M
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.