Some years ago, before I was lazy enough to just grab a module from CPAN, I wrote this handy Perl function to convert a dotted quad IP address to an integer.
1 2 3 4 5 6 7 8 9
I think the above is pretty, because it is easy to adapt to different bases etc. But it is also needlessly complex, a more elegant way to achieve the same is something like this:
1 2 3 4
Maybe these functions are of use to someone, though I would recommend everybody to use the excellent Net::IP Perl module instead!