open FILE, '<', "table.txt" or die $!; 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 > 1; $static++ if /Static/; } print @IPS;