in reply to If statement in Foreach loop

...though I know that one of the two companies is on the webpage

Look at this line:

@companies = ("FOO,BAR");
You are setting companies to an array with one element, the string "FOO, BAR". You want to set it to two elements in one of the following ways:
@companies = ("FOO", "BAR"); # or @companies = qw(FOO BAR);
better yet, you could set your regular expression to match either one and ditch the for loop:
# Use quotemeta if companies are not really # foo and bar and contain metacharacters. my $companies = join("|", map(quotemeta, qw(FOO BAR))); print "$1\n" if $content =~ /($companies)/;