I'm using Perl trying to insert an IP address from a log file into an INT field in a MYSQL table. So it needs to be converted into an int first. I thought the pack() function could do this for me, but I'm not sure I get the right thing. I also need to be able to extract it correctly later. Am I doing it right? If so, what code do I need to extract it?
IMHO inet_aton() is pretty lightweight, I think there is no other embedded way of doing this. Maybe you could create a sub to transform an IPv4 address into network byte order but that's just the point of inet_aton().