in reply to Re: If statement in Foreach loop
in thread If statement in Foreach loop

A followup on checking whether $content doesn't have what you think it does. A very common and easy way to make that mistake to make is to have a typo in a variable name. This can be very difficult to spot since your logic looks absolutely correct. (Your eye tends to fill in what it expects to see, so you skip over the typo again and again.)

However using strict.pm will catch the vast majority of these errors. Which is why it is good to be in the habit of writing strict-compliant code and then to use strict. For instance in this case:

foreach my $company (@companies) { # yada, yada }