[EMAIL PROTECTED] wrote: > Hi, Hello,
> if ($_ =~ m/match string/i) { > if ($_ =~ m/does not match string/i) { > } else { > print $_; According to that logic: $ perl -le' for ( "abcdefgh", "rstuvwxyz", "jklmnop", "abcdefwxyz" ) { if ( /cde/i ) { if ( !/xyz/i ) { } else { print } } } ' abcdefwxyz You want: if ( /match string/i && /does not match string/i ) { print; } > Regex is not my strong point, so I'm going to ask... Is there any way to > write > that better? Preferably only using one if statement? > > if (($_ =~ m/match string/i) && ($_ =~ m/does not match string/i)) { > print $_; > > I'm not to sure how to do the reverse of =~ for the does not match part... Or is this what you really want: $ perl -le' for ( "abcdefgh", "rstuvwxyz", "jklmnop", "abcdefwxyz" ) { if ( /cde/i && !/xyz/i ) { print } } ' abcdefgh John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>