Skip to content

Commit 7de5a42

Browse files
committed
Merge pull request #506 from sth/unnecessary-variables
Removed some unnecessary variables
2 parents 88573de + 32e0f47 commit 7de5a42

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ack

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,6 @@ sub print_line_with_context {
809809
}
810810

811811
my $ors = $opt_print0 ? "\0" : "\n";
812-
my $match_word = $opt->{w};
813812
my $is_tracking_context = $opt_after_context || $opt_before_context;
814813

815814
$matching_line =~ s/[\r\n]+$//g;
@@ -929,10 +928,9 @@ sub resource_has_match {
929928
}
930929
}
931930
else {
932-
my $re = $opt_regex;
933931
if ( $opt_v ) {
934932
while ( <$fh> ) {
935-
if (!/$re/o) {
933+
if (!/$opt_regex/o) {
936934
$has_match = 1;
937935
last;
938936
}
@@ -945,7 +943,7 @@ sub resource_has_match {
945943
local $/;
946944
<$fh>;
947945
};
948-
$has_match = $content =~ /$re/o;
946+
$has_match = $content =~ /$opt_regex/o;
949947
}
950948
close $fh;
951949
}
@@ -964,18 +962,17 @@ sub count_matches_in_resource {
964962
}
965963
}
966964
else {
967-
my $re = $opt_regex;
968965
if ( $opt_v ) {
969966
while ( <$fh> ) {
970-
++$nmatches if (!/$re/o);
967+
++$nmatches if (!/$opt_regex/o);
971968
}
972969
}
973970
else {
974971
my $content = do {
975972
local $/;
976973
<$fh>;
977974
};
978-
$nmatches =()= ($content =~ /$re/og);
975+
$nmatches =()= ($content =~ /$opt_regex/og);
979976
}
980977
close $fh;
981978
}
@@ -1114,8 +1111,6 @@ RESOURCES:
11141111
last RESOURCES if defined($opt_m) && $nmatches >= $opt_m;
11151112
}
11161113
elsif ( $opt_lines ) {
1117-
my $opt_passthru = $opt_passthru;
1118-
11191114
my %line_numbers;
11201115
foreach my $line ( @{ $opt_lines } ) {
11211116
my @lines = split /,/, $line;

0 commit comments

Comments
 (0)