#!/usr/bin/perl use strict; use warnings; while () { # print $+{pattern},qq(\n) if ( # for now, show the whole line print if ( m, ^ (?!\x23) (?:.*?) (? m? (?[/]) (?:(?:\\?+.)*?)*? \g{delimiter} ) ,x ); } __DATA__ #!/usr/bin/perl foo bar foo/bar /src/bin/oops/otehnoes if(/ok .*$/) { print "not OK\n"; } # skip a comment if(m/a good match/( { print "not ok\n"; } # do not /print/ this line either $string =~ s/[a-f]//g; # but print this line ( $string ) = ( $string =~ /(show this)/)); /but show\/this, too/ my $butdontprintthis = "/var/cache/dictionaries-common"; #### /src/bin/oops/otehnoes if(/ok .*$/) { if(m/a good match/( { $string =~ s/[a-f]//g; # but print this line ( $string ) = ( $string =~ /(show this)/)); /but show\/this, too/ my $dontprint this = "/var/cache/dictionaries-common"; #### if(/ok .*$/) { if(m/a good match/( { $string =~ s/[a-f]//g; # but print this line ( $string ) = ( $string =~ /(show this)/)); /but show\/this, too/