Stud_Perl has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Help please
by GrandFather (Saint) on Jun 26, 2005 at 23:56 UTC
    Homework? Show us what you have tried!

    Perl is Huffman encoded by design.
Re: Help please
by Zaxo (Archbishop) on Jun 26, 2005 at 23:53 UTC

    A fairly simple regex will take care of that.

    { local $_; while (<>) { /it (.*)[.?,]$/i and print $1, $/; } }

    Update: ++davidrw's points are accurate and easily corrected. I'll follow his lead and leave the modifications as an exercise. Also, you may wish to allow for any amount of any sort of whitespace after "it".

    After Compline,
    Zaxo

      Hmm.. does seem like homework as Grandfather suggested, so i won't post a regex, but instead these points for OP to consider (perldoc perlre) with regards to the above regex:
      • That will match the word "hit", and won't match "hit it." -- (hint: word boundary)
      • If there's multiple "it" words in the line, what do you want to print? (hint: greediness)
      • Should the trailing [.?,] be printed as well?
        I have searched far and wide and I can't find how to accomplish the printing of the trailing char from character set .?,
    A reply falls below the community's threshold of quality. You may see it by logging in.