开发者

How can I extract sentences with a particular phrase, in Perl? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_开发问答 Closed 10 years ago.

How can I write a Perl script that would scrape out sentences that mention 'Calvein Klein' in articles in a file named by $file? (Sentences can cross zero or more CR/LF characters.) I want to create an array of sentences scraped and print it at the end.


This is as much fish as I'm going to give out today.

Clearly you need to:

  • open the file
  • read in its contents
  • search through its lines for a particular pattern
  • create an array of sentences that match

Now, as you set about implementing each of these steps, you may run into more issues, but I'm sure if you think about it carefully you'll be able to come up with the right questions to ask. Then you should search the SO archives before asking that question, as you're not asking anything particularly unique or that hasn't come up here several times before.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜