in reply to Working with text files, thinking my issue is with variables inside if loops
Most likely it is due to the fact that your input lines contain newline characters at the end but you're comparing them to literal values which do not contain such newlines. Probably the easiest (though not necessarily the best) way to deal with this is simply to chomp the array of lines immediately after reading it:
There are numerous other optimizations you could make; I'll leave the pedants to show those to you.chomp @lines;
|
|---|