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 Rhinorhino 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
Joined
Aug 27, 2001
Messages
6
Location
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
 
here:

hex EXPR

Example:

print hex "10";

Output
16

Read this Manual:
----------------------------------------
There is no Knowledge, That is not power.

Yes, i'm a MySQL Newbie.
-Aaron
----------------------------------------
 
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.

Similar threads

Part and Inventory Search

Sponsor

Back
Top