#!/usr/bin/perl use warnings; use strict; my $static = 0; my @IPs; while () { push @IPs, $1 if /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/ and $static == 2; $static++ if /Static/; }