From 223c0ab0a158e4ea1963b3429b183840c2070d72 Mon Sep 17 00:00:00 2001 From: Andy Lester Date: Sat, 23 Nov 2024 22:37:49 -0600 Subject: [PATCH] More defined() instead of boolean. --- ack | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ack b/ack index a7883212..3b5f9bff 100755 --- a/ack +++ b/ack @@ -890,7 +890,7 @@ sub print_matches_in_file { if ( $in_range ) { $match_colno = undef; my $is_match = /$search_re/o; - if ( $is_match && $search_not_re ) { + if ( $is_match && defined($search_not_re) ) { local @-; $is_match = !/$search_not_re/o; } @@ -1139,10 +1139,10 @@ sub count_matches_in_file { if ( $using_ranges ) { while ( <$fh> ) { chomp; - $in_range = 1 if ( !$in_range && $opt_range_start && /$opt_range_start/o ); + $in_range = 1 if ( !$in_range && defined($opt_range_start) && /$opt_range_start/o ); if ( $in_range ) { my $is_match = /$search_re/o; - if ( $is_match && $search_not_re ) { + if ( $is_match && defined($search_not_re) ) { $is_match = !/$search_not_re/o; } if ( $is_match xor $opt_v ) { @@ -1150,14 +1150,14 @@ sub count_matches_in_file { last if $bail; } } - $in_range = 0 if ( $in_range && $opt_range_end && /$opt_range_end/o ); + $in_range = 0 if ( $in_range && defined($opt_range_end) && /$opt_range_end/o ); } } else { while ( <$fh> ) { chomp; my $is_match = /$search_re/o; - if ( $is_match && $search_not_re ) { + if ( $is_match && defined($search_not_re) ) { $is_match = !/$search_not_re/o; } if ( $is_match xor $opt_v ) {