Hi guys,
Me being a novice in perl,finding hard to sort it out.
$index=0;
$start_addr=0x50000000
for(i=$index; $i<256; $i++)
{
$addr=sprintf("%x",($start_addr=$start_addr + 4)); print "addr
+:$addr\n";
}
I get the numbers in their hex form(as 50000000,50000004,50000008,5000000c and so on..)My requirement is that i should get it as 0x50000000,0x50000004 and so on..For that i thought of converting this to a string and concatinating 0x to that and again converting back to hex.But i don't know how to start with.Is there exists a better solution to this?Please throw some light on this.
regards
shyam
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.