Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Conditional matching into qr variable

by rnewsham (Curate)
on May 29, 2013 at 10:58 UTC ( [id://1035816]=note: print w/replies, xml ) Need Help??


in reply to Conditional matching into qr variable

You can use multiple negative lookbehinds to do what you want. Although I imagine fellow monks will probably have a more elegant solution.

use strict; use warnings; for ( <DATA> ) { my $variable = qr/(?<!mild\s)(?<!moderate\s)active/; print $_ if ( m/$variable/ ); } __DATA__ foo active mild active moderate active active

Outputs

foo active active

Replies are listed 'Best First'.
Re^2: Conditional matching into qr variable
by ryanUK (Initiate) on May 31, 2013 at 10:04 UTC
    Dear Perl Monks - Thank you so much for your help!!!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-26 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found