Re: aside: perl's unpack()

2000-11-05 Thread Brad
On Sun, Nov 05, 2000 at 08:46:05PM +1100, Damien wrote: > > > > a.b.c.d > > > > n = d + c * 256 + b * 256 ^ 2 + a * 256 ^ 3 > > after reading the previous mail, this is what i was thinking. i went to test > it in perl afterwards, but got the wrong result. could anyone tell me what's > wrong with

Re: aside: perl's unpack()

2000-11-05 Thread Damien
> 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))), "\

Re: aside: perl's unpack()

2000-11-05 Thread Andy Bastien
There are those who would have you believe that Damien wrote: > > > I can tell you an easier way to decipher them, but I too would like to > > > know how they are contructed, i.e what's the algorithm. > > > > a.b.c.d > > > > n = d + c * 256 + b * 256 ^ 2 + a * 256 ^ 3 > > after reading the previ

aside: perl's unpack()

2000-11-05 Thread Damien
> > I can tell you an easier way to decipher them, but I too would like to > > know how they are contructed, i.e what's the algorithm. > > a.b.c.d > > n = d + c * 256 + b * 256 ^ 2 + a * 256 ^ 3 after reading the previous mail, this is what i was thinking. i went to test it in perl afterwards, b