I'm not afraid of regexes, per se, but I frequently have to write code that someone who isn't as decent at them as I am must read and maintain. I don't doubt for a moment that this is do-able with regex, but if it takes me an hour to figure it out, it'll take my teammates two to sort out what it's doing.
In cases like that, I'd use split and
sprintf to tidy those numbers up:
my (@octets) = split /\./,$input_string;
my $output_string = sprintf "%d\.%d\.%d\.%d",
Crystal-clear, utterly unambiguous, and it works. It's just my style, and TIMTOWTDI.