foreach my $line (@file_lines) {
chomp();
my $match_count=()=($line=~/Memphis/g);
two observations:
- With the code above you declare $match_count as a local variable of the foreach-loop. Therefore it is not valid when you try to print it
- => best define that variable before the while-loop
- I suppose you want to count the lines containing Memphis, ...; however you overwrite all your intermediate values with the value of the last line of the file ..
- => think of using the += operator instead of the =
HTH, Rata