#!/usr/bin/perl use strict; use warnings; my $ip="158.21.17.45"; my @values = split(".", $ip); print $ip,"\t\t",$#values,"\n"; exit(0); ----running the above---- ./temp3.pl 158.21.17.45 -1