I found this on the internet to convert an IPv4 address (w.x.y.z) to a decimal number.
w * 16,777,216 + x * 65,536 + y * 256 + z = decimalNumber I then found the subroutine, ip2dec in the script below. The script works, that's not my problem. The problem is "How does it work"? The "split /\./" I understand. I've looked at perldoc pack and sort of see it is taking the ip4 address, packing it up and then unpacking. But what's with these "=>" things? How is that routine meant to read? TIA Owen ======================================================== #!/usr/bin/perl use strict; use warnings; my $Originator = '127.0.0.1'; $Originator = ip2dec($Originator); my $stored = 'stored'; $stored = "$stored$Originator"; sub ip2dec { return unpack N => pack CCCC => split /\./ => shift; } print "$stored\n"; ======================================================== -- Owen -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/