while ($current_line = <$file_pointer>) { if ($current_line =~ /Grab this\s+(.*)/) { $GRAB = $1; push (@grab_array, $GRAB); print "$GRAB"; } }