use warnings; while ( ) { chomp; if ( /Impressions:/ ) { my($text, $value) = split(/:/, $_); print "Impressions: $value"; print "\n"; { no warnings "numeric"; $value += 0; # turn $value into a number } $impressions += $value; } }