#1
  1. No Profile Picture
    adam2000
    Guest
    Devshed Newbie (0 - 499 posts)
    Hi,
    Can someone please post me a way of converting a hex number to it's decimal equvalent using perl.

    In a UNIX shell script, I would have a variable set. eg.

    hex_nbr="A"

    .....and then I would like perl to take this variable as input and output a new variable with decimal equivalent. ie. dec_nbr="10"

    Regards,
    Adam
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Ft. Lauderdale, FL, US
    Posts
    29
    Rep Power
    0
    you can...

    $dec_nbr = hex("A");

    hex() converts hex to decimal.
  4. #3
  5. No Profile Picture
    adam2000
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanks - works like a charm!

IMN logo majestic logo threadwatch logo seochat tools logo