shyam123 has asked for the wisdom of the Perl Monks concerning the following question:
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.
regardsshyam
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To convert hex number into string
by ikegami (Patriarch) on Dec 02, 2012 at 12:40 UTC | |
|
Re: To convert hex number into string
by Athanasius (Archbishop) on Dec 02, 2012 at 13:03 UTC |