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

Re^2: pack and unpack trouble

by scoobyrico (Beadle)
on Dec 22, 2011 at 18:30 UTC ( #944823=note: print w/replies, xml ) Need Help??

in reply to Re: pack and unpack trouble
in thread pack and unpack trouble

Excellent! as a follow up, if I want to take 1365238130 to 515FE172? Upate: I would have thought it was hex(1365238130) but that gets me 83301204272. So clearly I am doing something wrong.
In C#
uint temp = 1365238130; System.Console.WriteLine(temp.ToString("X"));

Replies are listed 'Best First'.
Re^3: pack and unpack trouble
by Util (Priest) on Dec 22, 2011 at 19:00 UTC
    Adapted from perlfaq4: How do I convert between numeric representations/bases/radixes?
    my $hex_string = sprintf '%X', 1365238130;
Re^3: pack and unpack trouble
by ikegami (Patriarch) on Dec 22, 2011 at 20:23 UTC

    hex converts *from* hex to a number.

    sprintf '%X', $n will represent a number using hex.

      Thanks so much! I had totally forgotten about sprintf

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://944823]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2022-01-27 23:07 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (72 votes). Check out past polls.