while(){ $/="\n--\n"; ($_ =~ /ABC SET/)?$values++:next; }