in reply to If statement in Foreach loop

Have you checked to make sure $content actually has something in it? There could be a problem with your get($url) subroutine. When you're debugging, you shouldn't take anything for granted.