Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert string "000B" to hex 000B and decimal 11

Status
Not open for further replies.

perl8rookie

Programmer
Apr 25, 2008
4
0
0
US
How can i convert a string numerical value into other formats such as hex or decimal?

For Example:

$string = "000B"

I want this to be translate to a numerical value:

$hex = 000B
$decimal = 11

You response will be appreciated. Thanks.
 
one way:

Code:
$string = "000B";
print hex $string;

You can also look up:

hex
oct
sprintf
printf
pack
unpack

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top