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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hexadecimal conversion

Status
Not open for further replies.

ckstick

Programmer
Aug 27, 2001
6
FR
hi !

i'd like to develop a cgi script that takes in entry a string (basically a sentence of ascii characters) and makes its conversion to hexadecimal.
do you know which function i may use


thank you guys
 
thank you for answering me but :
in fact, what i look for is the reverse conversion.
how to get 10, by writing :
print "hexadecimal equivalent of 16";



 
You can use sprintf to do that trick...

$var = sprintf "%lx", 16;
print "$var\n";


HTH


keep the rudder amid ship and beware the odd typo
 
thank you, your trick is exactly what i was lookin' for !
 
I used this two function : pack and unpack

For exemple :
Code:
$input = "string";
$var = unpack "H*", $input;
print $var;
 
thank you phidgi... with this, i can make the conversion of the whole sentence. Great !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top