http://www.perlmonks.org?node_id=807339


in reply to Re: does split(".") work?
in thread does split(".") work?

Dot "." is the "match-all" character in a regex so your split won't return anything.

Actually split returns a lot of things, it's just that the way list assignment works there is nothing left to put in the array.    If you make a slight change you can see everything that split returns:

$ perl -le'my $ip="158.21.17.45"; my @values = split(".", $ip, -1); pr +int $ip,"\t\t",$#values,"\n";' 158.21.17.45 12