> IP networks use big-endian notation and PCs use little-endian; you > need to convert the value before splitting it back into octets: > > > ($a, $b, $c, $d) = split(/\./, "50.55.48.52"); > $n = $d + ($c << 8) + ($b << 16) + ($a << 24); > print "$n = ", join(".", unpack("C4", pack("N", $n))), "\n"; thank you, that's exactally what i was after. i got confused and was looking for big endian versions of the unpack("C.. part. cheers! -- Damien <bitwise@repose.cx>
Attachment:
pgp4bT3BACTes.pgp
Description: PGP signature