in reply to Re^3: Help please
in thread Help please

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^5: Help please
by graff (Chancellor) on Jun 28, 2005 at 22:30 UTC
    It looks like you are not really assigning a value to $_. Try it like this:
    $_ = "Tim created the ..."; while ( /\bit (.*?)[.?!]/ig ) { print "\n$1\n"; }
    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:
    while (<>) { 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.)

    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:

    perl test.pl test.txt
    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.
    A reply falls below the community's threshold of quality. You may see it by logging in.