Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: using grep to find a word

by space_monk (Chaplain)
on Jun 24, 2013 at 09:31 UTC ( #1040406=note: print w/ replies, xml ) Need Help??


in reply to using grep to find a word

Don't have a Perl install on here to check it, but this is close...

#!/usr/bin/perl use strict; use warnings; my @words = qw( first second third% fourth% fifth); my @results = grep (/%$/, @words); print "Found:".join(",", @results)."\n" if (@results);
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)


Comment on Re: using grep to find a word
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040406]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-07-08 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls