my @array; while ($line = ) { if ($line =~ /regexp/) { push(@array, $line); } }