while () { push @array, $_; } #### while () { if (/$pattern/) # matches work by default on $_ { do something with $_; } } #### $inner = "([0-5][0-9]|[0-9][1-8])"; $outer = "$inner.$inner.$inner/[0-6]"; # Can also be written $outer = join('.', $inner x 3) . "[0-6]"