#!/usr/bin/perl
$foo = 10;
$hexval = sprintf("%x", $foo);
$decval = hex($hexval);
print "n$foo in hex is $hexval and in dec is $decvaln";
# end
Cut and paste the above code into a new file, save it as hexdec.pl or dechex.pl or whatever and ensure that you have execute permissions. The script creates a variable, $foo with a value of your choice, (in this case 10). It will then print out it's value in hexadecimal and in decimal.
Christo
follow me on twitter to catch all my tech updates: http://www.twitter.com/planet_guru






