Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Representing a 32-bit integer

by jettero (Monsignor)
on May 22, 2007 at 19:48 UTC ( [id://616851]=note: print w/replies, xml ) Need Help??

in reply to Representing a 32-bit integer

You want unpack, not pack, imo. Although, the document describing pack is a great deal more detailed. Also, see Socket for the inet_aton function, which is of great relevance here.

use Socket; print "", unpack("N", inet_aton("")), "\n";

UPDATE: This has been amusing me for many minutes now (e.g. unpack("N", inet_aton(""))). Thanks!

  1. http://1089054563/
  2. http://1109866011/


Replies are listed 'Best First'.
Re^2: Representing a 32-bit integer
by Thelonius (Priest) on May 22, 2007 at 20:35 UTC
    Or unpack "N", pack "C4", split /\./, $IPaddr

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-06-18 14:40 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.