Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Help please

by Stud_Perl (Initiate)
on Jun 26, 2005 at 23:46 UTC ( [id://470100]=perlquestion: print w/replies, xml ) Need Help??

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

This node falls below the community's threshold of quality. You may see it by logging in.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://470100]
Approved by Zaxo
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-25 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found