in reply to Re: Match with line without a word
in thread Match with line without a word
I would suggest one of the below formulations. Tweak to suit your needs.
oops, my brain is really out to lunch today...sorry.see update
I wouldn't get overly concerned about performance unless this code is going to be executed lots of times. Clarity should be the first priority.#!/usr/bin/perl -w use strict; my @input = ("Exception : CEX", "Exception : TEX", "abc def ljj"); print grep{!/CEX/}grep{/^\s*Exception/}@input; print "\n"; print grep{/Exception/ && !/CEX/}@input; print "\n"; __END__ prints: Exception : TEX Exception : TEX
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Match with line without a word
by Heaven (Initiate) on Aug 07, 2009 at 10:09 UTC |