#!/usr/bin/perl use strict; use warnings; my $first_octet_num = "1"; my $ip_address; foreach (1..254) { foreach (1..255) { if ($_ <= 254) { $ip_address = join ('.', 192,168,$first_octet_num,$_); print "$ip_address\n"; } else { $first_octet_num++; } } }