$/="\n--\n"; while () { $value++, next if /.*?ABC SET.*\n.*\n--\n/; }