in reply to Re^5: Need help with (un)pack templates
in thread Need help with (un)pack templates

an IP address is 4 8-bit numbers, not a 32-bit number
s/is/is normally represented as/;

$ host perlmonks.org perlmonks.org has address 66.39.54.27 $ perl -le 'print ((66 * 256**3)+(39 * 256**2)+(54 * 256)+27);' 1109866011 $ perl -le 'print unpack('N',(gethostbyname("perlmonks.org"))[4]);' 1109866011
Many web browsers accept the decimal value of the IP address: http://1109866011/

Replies are listed 'Best First'.
Re^7: Need help with (un)pack templates
by gmargo (Hermit) on Dec 20, 2009 at 17:08 UTC

    s/is normally represented as/is encoded in an IP header as/; # :-)