in reply to Converting Hexadecimal to Decimal notation and vice-versa

It works for me (once I've fixed the errors in your posted code):

use strict; use warnings; use Math::BigInt; # Missing from your posted code my $x_dec = Math::BigInt->from_hex("0x000102030405060708090a0b0c0d0e0f +"); print $x_dec, "\n"; # Not $x, as in your posted code # Output: 5233100606242806050955395731361295

Replies are listed 'Best First'.
Re^2: Converting Hexadecimal to Decimal notation and vice-versa
by Anonymous Monk on Oct 17, 2009 at 18:34 UTC
    Hi, thanks.
    We had an older version of Math::BigInt and that is why it seems it could not locate method from_hex.
    How do I convert a huge integer to hexadecimal using Math::BigInt?
      How do I convert a huge integer to hexadecimal

      ->as_hex()

        Hi,
        I tried the following and I got 'NaN' as the result.
        #!/usr/bin/perl use strict; use warnings; package main; use Math::BigInt; my $gene_sample_101dcef = Math::BigInt->as_hex("5555181933400000000066 +6"); print $gene_sample_101dcef,"\n";