Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: to convert 16 dig hex to dec

by haoess (Curate)
on Sep 01, 2005 at 10:15 UTC ( #488338=note: print w/replies, xml ) Need Help??

in reply to to convert 16 dig hex to dec

print hex $value;

Update: Nevermind this throws a warning:

Integer overflow in hexadecimal number

A way without warnings:

perl -Mbigint -wle 'print 0x9DBE062CB1F34287'

Please, please have a look at the documentation search engine.

-- Frank

Replies are listed 'Best First'.
Re^2: to convert 16 dig hex to dec
by QM (Parson) on Sep 01, 2005 at 15:41 UTC
    perl -Mbigint -wle 'print 0x9DBE062CB1F34287'
    Shouldn't that be:
    perl -MMath::Bigint -wle 'print 0x9DBE062CB1F34287'
    or is there some new namespace I'm not aware of?

    Update: I didn't look carefully enough. And I was cross-pollinated with:

    perl -MMath::Bigint -wle 'print Math::BigInt->new(q/0x9DBE062CB1F34287 +/)'

    Quantum Mechanics: The dreams stuff is made of

      Try it.

      And read "perldoc bigint"
        Of course! Curse my narrow-minded field of view.

        Quantum Mechanics: The dreams stuff is made of

Re^2: to convert 16 dig hex to dec
by Anonymous Monk on Sep 01, 2005 at 10:39 UTC
    I am getting an overflow error Integer overflow in hexadecimal number at line 8. This is the output 1.13665292985635e+019 I need the output as not in exponential notation but string and I have tried
    $dec = hex $hex; printf "%s", $dec;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://488338]
[stevieb]: As far as Dist::Zilla goes, I don't like installing that other than on systems my test platorm runs on. I find it too heavy. I prefer being able to glean a Makefile.PL
[LanX]: what's frustrating me is that a distribution has lots of dupplicated info
[stevieb]: LanX I don't know if it's dialog driven; I just use it in the simplest of terms (just run module-starter at the CLI, and the very last couple of lines are how I use it.
[stevieb]: which dist are you speaking of regarding dups, LanX?
[LanX]: readme version number and so on ...
[stevieb]: with M::S, you can also add other tags, but defaults work... such as --license=perl --eumm
[LanX]: I'm not a big fan of pure make, apparently the auto generated ones are so complicated to be able to work with all possible makes
[stevieb]: I find the M::S makefiles it generates are quite straight forward, and I usually have to add a few things (github info etc). They're about 15 lines or so give or take.
[Corion]: I don't think the EUMM-generated Makefile is that complicated ;)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-08-18 20:58 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (310 votes). Check out past polls.