my $IP = '127.0.0.1'; # or whatever my $abs_IP = join '', map { sprintf "%03d", $_ } split /\./, $IP;