Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Is the documentation for Perl 5.20 'pack' correct?

by flexvault (Monsignor)
on Jul 06, 2015 at 23:52 UTC ( [id://1133462]=note: print w/replies, xml ) Need Help??


in reply to Re: Is the documentation for Perl 5.20 'pack' correct?
in thread Is the documentation for Perl 5.20 'pack' correct?

Hello Corion,

    ...you'll have to tell us what the byte order on disk was :-)

Displaying the disk file in hex, the packed number 16909060 is:

my $packed_number = pack( "N", 16909060 );
displayed as hex '01020304' :-)

Further, you can just do the following:

my $packed_number = pack( "N", 16909060 ); print unpack("H8",$packed_number),"\n";
which yields hex '01020304'.

Regards...Ed

"Well done is better than well said." - Benjamin Franklin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-03-28 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found