Listing 4. A Simple Perl Script that Generates Class C IP Addresses

#! /usr/bin/perl

$networkid = "192.168.0";
$begin = 1;
$end = 20;

for ($hostid = $begin; $hostid <= $end; $hostid++) {
    print "$networkid.$hostid\n";
}