use strict; my $count = 1; my $line = 0; while (<DATA>) { $line++; $count = 1, next if /^<main>/; die "out of order at line $line!" if /<sub(\d+)>/ && $1 != $count++; } __DATA__ <main>Ability-oriented motivation, 00206.p0105 <main>Ability test <sub1>in conjunction with achievement batteries, 00226.p0085 <sub3>definition, 00226.g0005 <main>Aboriginal athletes, 00954.p0155 <sub2>Absolutism, 00688.p0010
In reply to Re: How to validate file format
by holli
in thread How to validate file format
by gube
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |