#Context Mbox User Zone NewMsg #default 1234 Example Mailbox 1 #other 1234 Company2 User 0 my ($results,$start)=(0,0); my @fields; while (($line = $pop->getline) and ($line !~ /--END/o)) { if ($start) { @fields = (split ' ', $line); $results = $results + pop(@fields); } $start = 1 if ($line =~ /Context/o); }