user3781528 user3781528 - 1 year ago 41
Perl Question

Ignore rows that do not contain specific text

How can I ignore rows that do not contain the text

with Perl?

The following code skips rows that contain
and I would like to capture rows that contain

while ( <$in_fh> ) {

next if /^#/;
next if /\b(?:CNV)\b/;


Answer Source

How about changing the if to unless? :)

next unless /\b(?:CNV)\b/;