in reply to Re^4: Help please
in thread Help please
Once you see that this works more or less the way you want, try putting the data into a file -- call it "test.txt" -- and make the script look like this:$_ = "Tim created the ..."; while ( /\bit (.*?)[.?!]/ig ) { print "\n$1\n"; }
(That is, remove the long data string from the script, and just have the two while loops as shown.)while (<>) { while ( /\bit (.*?)[.?!]/ig ) { print "\n$1\n"; } }
If the script is stored in a file called "test.pl", you can now run it on your test data file using the following command line:
Then start spending some time reading some of the basic tutorials and introductory books about Perl, and study the example code in those sources to get more familiar with the syntax.perl test.pl test.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |