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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: does split(".") work?
by ysth (Canon) on Nov 16, 2009 at 05:45 UTC |