in reply to The third 'if'

Maybe I'm missing one of those special shortcuts in perl (I certainly don't claim to know even 1/3 of all of them), but I don't see where you are attempting to read in the next line before testing if ( /Impressions:/ )

As an aside, I'll have to strongly agree with Zaxo that your formatting (at least as posted here) really needs some help for readability! Somebody++ cleaned it up.