Try checking regular expression return values. Given this:
my $line = "I am the very model of a modern major general.";
my $good_match = $line =~ m/major/;
my $bad_match = $line =~ m/corporal/;
print "$line\n" if $good_match == 1; # Prints the line.
print "$line\n" if $bad_match == 1; # Doesn't print anything.
A successful regular expression match will return 1, so you can check against that. It prints the line if the match was made, and doesn't if it wasn't.
Update: Whoops, missed that you were doing that implicitly. Kyle has the correct answer.