in reply to does split(".") work?

[ This is a different spin on the same answer. ]

split's first argument isn't matched literally. It's treated as a regex pattern. The regex pattern can be provided as any of the following:

The following are equivalent:

my @octets = split('\\.', $ip); my @octets = split(qr/\./, $ip); my @octets = split(/\./, $ip);

I always use the last syntax. It avoids confusion.

You might also be interested in Socket's inet_aton (and inet_ntoa).

(Note that split ' ' is special. See split's documentation if you're interested in details.)