while () { if (/Impressions:/) { print; $impressions += $1 if /(\d+)/; } }