On Aug 23, P lerenard said:
>I can transform an ip a1.a2.a3.a4 to an integer using
>b1=a1 << 24
>b2=a2 << 16
>b3=a3 << 8
>int =b1+b2+b3+a4
>now I want to do the opposite.
>how can I get a1.a2.a3.a4 from this integer?
>ok I get a1, but I start to have a headeach to get the rest
Do:
while ($x) {
unshift @parts, $x % 256;
$x >>= 8;
}
and that will give you the parts you need.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]