Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: 'and' greps

by philipbailey (Chaplain)
on Jul 29, 2009 at 19:29 UTC ( #784340=note: print w/ replies, xml ) Need Help??


in reply to Re^2: 'and' greps
in thread 'and' greps

Something like this should work for you:

#!/usr/bin/perl use warnings; use strict; my @to_match = qw/his her theirs/; START: for my $line (<DATA>) { for my $item (@to_match) { next START unless $line =~ /$item/; } print $line; } __DATA__ his her theirs asdf his her something else this shouldn't match either


Comment on Re^3: 'and' greps
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2015-07-31 11: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 (276 votes), past polls