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!!!