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.
views:
83answers:
1
+5
A:
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.
Ether
2010-03-30 22:34:08
I don't want fish! I want waffles!!!
DVK
2010-03-31 00:57:16