in reply to simple padding of IP address
See
perldoc -f sprintf.
my $twelve_digit_str = sprintf "%03d%03d%03d%03d", split /\./, $ip_address;
Update: or even
my $twelve_digit_str = sprintf "%03d" x 4, split /\./, $ip_address;
____________Makeshifts last the longest.