$ip="1.2.3.4"; @ipnum=split(/./,$ip); $ipnum[$#ipnum]++; # this increments the last digit.. # then $ip=join(".",@ipnum); # result is '1.2.3.5';